I known my question look like personal satisfaction. But I don't understand What purpose if bracket style not difference from normal way.
class A
{
public Boolean Property1 { get; set; }
public Boolean Property2 { get; set; }
public Boolean Property3 { get; set; }
public Boolean Property4 { get; set; }
}
static void TestClassPropertyInitialize()
{
A a = new A() // Not complete property. Should error ?
{
Property1 = true,
Property2 = false,
};
// Normal style
a.Property3 = false;
a.Property4 = false;
}
From @steve recomment this topic. What's the difference between an object initializer and a constructor?
But my question is focus on properties setting (Not constructure). I known this question difficult to answer because it 's depend on designer language.
More info. Should error ? in my sample code. Meaning why this line of code not cause complie-time error. Because only 2 of 4 properties setting.