Why Automatically implemented properties must define both get and set accessors.
Posted
by Nasser Hajloo
on Stack Overflow
See other posts from Stack Overflow
or by Nasser Hajloo
Published on 2010-04-08T06:06:25Z
Indexed on
2010/04/08
6:13 UTC
Read the original article
Hit count: 399
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 ?
© Stack Overflow or respective owner