Showing posts with label Property Initializers. Show all posts
Showing posts with label Property Initializers. Show all posts

Friday, August 29, 2008

DID U NO?!?!!111

So maybe I'm slow, but it just dawned on me that:
 SomeClass class = new SomeClass() { SomeProperty = "" };
Is the same as:
 SomeClass class = new SomeClass { SomeProperty = "" };
What?? Look closely. The "new SomeClass" no longer needs the () if you are using 3.0's property initializers. Not ground breaking, but interesting.