As much as I agree with downvoting a crappy question, is it really that bad to have a(nother) resource noting that the below compile essentially identically?
Is there a way to tell whether a property is being set like this
MyClass myClass = new MyClass() { Value = 5 };
or this
MyClass myClass = new MyClass();
myClass.Value = 5;
?
In my application, I need to use would prefer to use object initializer syntax, but I also need setter logic that only occurs during object construction.
I assume the answer is no, as (to my knowledge) the first is essentially a shortcut for the second. But otherwise I'll have to put logic in the setter that should only ever run once or change my initialization syntax — neither of which sound attractive.