共用方式為


編譯器錯誤 CS0629

更新:2007 年 11 月

錯誤訊息

條件成員 'member' 無法在型別 'Type Name' 中實作介面成員 'base class member'

介面的實作 (Implementation) 中不可使用條件屬性 (Attribute)。

下列範例會產生 CS0629:

// CS0629.cs
interface MyInterface
{
   void MyMethod();
}

public class MyClass : MyInterface
{
   [System.Diagnostics.Conditional("debug")]
   public void MyMethod()    // CS0629, remove the Conditional attribute
   {
   }

   public static void Main()
   {
   }
}