C# Error CS0762 – Cannot create delegate from method ‘{0}’ because it is a partial method without an implementing declaration

C# Error

CS0762 – Cannot create delegate from method ‘{0}’ because it is a partial method without an implementing declaration

Reason for the Error & Solution

Cannot create delegate from method ‘method’ because it is a partial method without an implementing declaration

A partial method is not required to have an implementing declaration. However, a delegate does require that its encapsulated method have an implementation.

To correct this error

  1. Provide an implementation for the method that is used to initialize the delegate.

Example

public delegate void TestDel();  
  
    public partial class C  
    {  
        partial void Part();  
  
        public static int Main()  
        {  
            C c = new C();  
            TestDel td = new TestDel(c.Part); // CS0762  
            return 1;  
        }  
  
    }  

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

C# Compiler Error CS0442 – ‘Property’: abstract properties cannot have private accessors Reason for the Error You’ll get this error...
This is a really simple one . Below is a simple example of an enum called “Designation” defined with the...
This blog post explain the usage of the Checked Block in .NET and how you can use them in Visual...