共用方式為


編譯器錯誤 CS0577

更新:2007 年 11 月

錯誤訊息

Conditional 屬性在 'function' 上無效,因為它是建構函式、解構函式、運算子或明確介面實作

Conditional 無法套用至指定的方法。

例如,您無法在明確介面定義上使用某些屬性。下列範例會產生 CS0577:

// CS0577.cs
// compile with: /target:library
interface I
{
   void m();
}

public class MyClass : I
{
   [System.Diagnostics.Conditional("a")]   // CS0577
   void I.m() {}
}