This documentation is archived and is not being maintained.

Compiler Error CS0123

Method 'method' does not match delegate 'delegate'

An attempt to create a delegate failed because the correct signature was not used. Instances of a delegate must be declared with the same signature of the delegate declaration.

You can resolve this error by adjusting either your method or delegate signature.

The following sample generates CS0123:

// CS0123.cs
delegate void D();
// try the following line instead
// delegate void D(int i);

public class C
   public static void f(int i)

   public static void Main()
      D d = new D(f);   // CS0123