共用方式為


編譯器錯誤 CS0069

更新:2007 年 11 月

錯誤訊息

介面中的事件不能有 add 或 remove 存取子

您不能在事件中定義事件的存取子 (Accessor) 函式。如需詳細資訊,請參閱事件 (C# 程式設計手冊)介面 (C# 程式設計手冊)

下列範例會產生 CS0069:

// CS0069.cs
// compile with: /target:library

public delegate void EventHandler();

public interface a
{
   event EventHandler Click { remove {} }   // CS0069
   event EventHandler Click2;   // OK
}