Compiler Error CS0736
'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 static 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() { }
}
}
See also
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.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for