Why Automatically implemented properties must define both get and set accessors.
- by Nasser Hajloo
When we define a property like
public string Name {get; set;}
dot net can make our properties code. but when we use
public string Name {get;}
public string Name {set;}
we face with
'Hajloo.SomeThing.PropertyName.set' must declare a body because it is not marked abstract or extern. Automatically implemented properties must define both get and set accessors.
Actualy whay compiler can't determine the property and make code automatically ? what's happen ?