更新:2007 年 11 月
错误消息
“property”:属性或索引器不能有 void 类型
void 作为属性的返回值无效。
有关更多信息,请参见属性。
下面的示例生成 CS0547:
// CS0547.cs
public class a
{
public void i // CS0547
// Try the following declaration instead:
// public int i
{
get
{
return 0;
}
}
}
public class b : a
{
public static void Main()
{
}
}