views:

186

answers:

1

In C#, you can do something like this:

SomeClass someClass = new SomeClass () {
    SomeProperty = someValue
};

What is this syntax called?

+18  A: 

Object initializer is the name.

Ngu Soon Hui
pretty Yodaish answer
Shankar Ramachandran
Wouldn't that be more like "Object initializer the name is. Hmmph! Much to learn you have."
Robert
If so smart Yoda is, right order words in his sentences Yoda puts not why?
Eric Lippert
If I remember my Star Wars mythos correctly, Yoda spoke grammatically correct english up until the day he read *Chapter 7: Wisdom You Have Not, But Sound Like It You Will* of the book *Jedi Grammer Hacks: You May Have The Force, But Your Words Are Not Forceful*. ...or I just made that up.
Robert