다음을 통해 공유


컴파일러 오류 CS1594

업데이트: 2007년 11월

오류 메시지

'delegate' 대리자에 잘못된 인수가 있습니다.
Delegate 'delegate' has some invalid arguments

delegate 호출에 전달한 인수의 형식이 대리자 선언에 있는 매개 변수의 형식과 다릅니다.

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

// CS1594.cs
using System;
delegate string func(int i);   // declare delegate

class a
{
   public static void Main()
   {
      func dt = new func(z);
      x(dt);
   }

   public static string z(int j)
   {
      Console.WriteLine(j);
      return j.ToString();
   }

   public static void x(func hello)
   {
      hello("8");   // CS1594
      // try the following line instead
      // hello(8);
   }
}