更新:2007 年 11 月
错误消息
“property”:属性或索引器必须至少有一个访问器
属性必须至少有一个访问器(get 或 set)方法。
有关更多信息,请参见 使用属性(C# 编程指南)。
示例
下面的示例生成 CS0548。
// CS0548.cs
// compile with: /target:library
public class b
{
public int MyProp {} // CS0548
public int MyProp2 // OK
{
get
{
return 0;
}
set {}
}
}