Export (0) Print
Expand All
Expand Minimize

Compiler Error CS0123 

Error Message

No overload for 'method' matches 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 as the delegate declaration.

You can resolve this error by adjusting either the method or delegate signature. For more information, see Delegates (C# Programming Guide).

The following sample generates CS0123.

// CS0123.cs
delegate void D();
delegate void D2(int i);

public class C
   public static void f(int i) {}

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

Community Additions

© 2015 Microsoft