更新:2007 年 11 月
错误消息
修饰符“abstract”对字段无效。请尝试改用属性
您不能使字段成为抽象的。不过,您可以有访问该字段的抽象属性。
示例
下面的示例生成 CS0681:
// CS0681.cs
// compile with: /target:library
abstract class C
{
abstract int num; // CS0681
}
请尝试改用以下代码:
// CS0681b.cs
// compile with: /target:library
abstract class C
{
public abstract int num
{
get;
set;
}
}