This is an initializer of nested objects. It is described in the C # 4 specification as follows:
The initializer of the element that indicates the initializer of the object after the equal sign is the initializer of the nested object, that is, the initialization of the embedded object. Instead of assigning a new value to a field or property, assignments in the initializer of nested objects are treated as assignments to members of a field or property. Initializers of nested objects cannot be applied to properties with a value type or to read-only fields with a type value.
So this code:
MyClass foo = new MyClass { Property = { IntfProp = 5 }};
will be equivalent to:
MyClass tmp = new MyClass();
source share