C# Error CS0736 – ‘{0}’ does not implement instance interface member ‘{1}’. ‘{2}’ cannot implement the interface member because it is static.

C# Error

CS0736 – ‘{0}’ does not implement instance interface member ‘{1}’. ‘{2}’ cannot implement the interface member because it is static.

Reason for the Error & Solution

‘type name’ does not implement interface member ‘member name’. ‘method name’ cannot implement an interface member because it is static.

This error is generated when a static method is either implicitly or explicitly declared as an implementation of an interface member.

To correct this error

  • Remove the modifier from the method declaration.

  • Change the name of the interface method.

  • Redefine the containing type so that it does not inherit from the interface.

Example

The following code generates CS0736 because Program.testMethod is declared as static:

// cs0736.cs  
namespace CS0736  
{
  
    interface ITest  
    {  
        int testMethod(int x);  
    }  
  
    class Program : ITest // CS0736  
    {  
        public static int testMethod(int x) { return 0; }  
        // Try the following line instead.  
        // public int testMethod(int x) { return 0; }  
        public static void Main() { }  
    }
}  

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...