K
K Viltersten
When i initialize an object, the syntax goes
as follows (note the lack of parentheses).
var name = MyClass { Property = 5; }
My collegaues argued yesterday that the
correct (or at least more intuitive) approach
would be to add "()" as follows.
var name = MyClass() { Property = 5; }
While both sytaxes are correct, i wonder if
there's a guideline or a general concensus
regarding this difference. Perhaps just a
matter of taste?
as follows (note the lack of parentheses).
var name = MyClass { Property = 5; }
My collegaues argued yesterday that the
correct (or at least more intuitive) approach
would be to add "()" as follows.
var name = MyClass() { Property = 5; }
While both sytaxes are correct, i wonder if
there's a guideline or a general concensus
regarding this difference. Perhaps just a
matter of taste?