C# Compiler Errors


Visual C# Reference: Errors and Warnings 
Compiler Error CS0536 

Error Message

'class' does not implement interface member 'interface member'. 'class member' is static, not public, or has the wrong return type

' class ' does not implement interface member ' member1 '. ' member2 ' is either static, not public, or has the wrong return type.

The compiler did not detect an interface member implementation. A declaration may be present that almost implements the interface member. Check for the following syntax errors in the declaration for the interface member:

  • public keyword is omitted.

  • Return type does not match.

  • static keyword is present.

The following sample generates CS0536:

// CS0536.cs
public interface a
{
   void f();
}

public class b : a
{
   public static int f()   // CS0536
   // try the following line instead
   // public void f()
   {
   }

   public static void Main()
   {
   }
}
Tags :


Page view tracker