Share via


컴파일러 오류 CS0068

업데이트: 2007년 11월

오류 메시지

'event': 인터페이스의 이벤트에는 이니셜라이저를 사용할 수 없습니다.
'event': event in interface cannot have initializer

인터페이스의 이벤트에는 이니셜라이저를 사용할 수 없습니다. 자세한 내용은 인터페이스(C# 프로그래밍 가이드)를 참조하십시오.

다음 샘플에서는 CS0068 오류가 발생하는 경우를 보여 줍니다.

// CS0068.cs

delegate void MyDelegate();

interface I
{
   event MyDelegate d = new MyDelegate(M.f);   // CS0068
   // try the following line instead
   // event MyDelegate d2;
}

class M
{
   event MyDelegate d = new MyDelegate(M.f);

   public static void f()
   {
   }

   public static void Main()
   {
   }
}