Compiler Error CS0123
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.
The following sample generates CS0123.
C#
// 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
}
}
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
.NET feedback
.NET is an open source project. Select a link to provide feedback: