共用方式為


編譯器錯誤 CS0681

更新:2007 年 11 月

錯誤訊息

修飾詞 'abstract' 在欄位上無效。嘗試用屬性替代。

您不能使欄位變為抽象。不過,您可以擁有存取該欄位的抽象屬性 (Property)。

範例

下列範例會產生 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;
    }
}