共用方式為


編譯器錯誤 CS1609

更新:2007 年 11 月

錯誤訊息

修飾詞不能置於事件存取子宣告中

修飾詞只能置於事件宣告中,且不能置於事件存取子宣告中。如需詳細資訊,請參閱使用屬性 (C# 程式設計手冊)

範例

下列範例會產生 CS1609。

// CS1609.cs
// compile with: /target:library
delegate int Del();
class A
{
   public event Del MyEvent 
   {
      private add {}   // CS1609
      // try the following line instead
      // add {}
      remove {}
   }
}