【发布时间】:2010-04-08 06:06:25
【问题描述】:
当我们定义像这样的属性时
public string Name {get; set;}
dot net 可以制作我们的属性代码。但是当我们使用
public string Name {get;}
public string Name {set;}
我们面对
'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.
究竟为什么编译器不能确定属性并自动生成代码?有什么问题?
【问题讨论】:
标签: c# get properties set accessor