How to Resolve Error "CS0736: Member does not implement instance interface member because it is static" in C#
The Compiler Error CS0736 is an implementation mismatch error. The message reads: "'ClassMember' does not implement interface member 'InterfaceMember'. It cannot implement the interface member because it is static."
In C#, standard interfaces define a contract for objects (instances). When an interface declares a method void DoWork();, it expects the implementing class to provide an instance method that can be called on an object of that class. If your class provides a static method with the same name, it fails to satisfy the contract because static methods belong to the class itself, not to the object.
This guide explains why static methods cannot fulfill instance requirements and how to resolve the conflict.
Understanding Interface Contracts
By default, interface members are instance-based.
- Interface Definition:
void Run();impliesmyObject.Run();. - Static Implementation:
static void Run()impliesMyClass.Run();.
Because myObject.Run() cannot structurally call MyClass.Run() directly (without a wrapper), the compiler rejects the static method as a valid implementation of the interface member.
C# 11 Static Abstract Members:
Modern C# allows static abstract members in interfaces. However, CS0736 specifically occurs when the interface expects a standard instance member and you provide a static one.
Scenario: Implementing with a Static Method
This error often happens when you have a utility method that doesn't use any instance state (so you marked it static for performance or logic reasons), but you also need to implement an interface that requires that method signature.
Example of error:
public interface ICalculator
{
// Expects an instance method
int Add(int a, int b);
}
public class MathUtils : ICalculator
{
// ⛔️ Error CS0736: 'MathUtils.Add(int, int)' does not implement
// interface member 'ICalculator.Add(int, int)'.
// It cannot implement the interface member because it is static.
public static int Add(int a, int b)
{
return a + b;
}
}
Solution 1: Remove the static Keyword
If the method must implement the interface directly, it must be an instance method. Even if it doesn't touch any instance fields (this), removing static makes it compatible with the interface.
Solution:
public class MathUtils : ICalculator
{
// ✅ Correct: Now an instance method.
// Even though it doesn't use 'this', it satisfies the contract.
public int Add(int a, int b)
{
return a + b;
}
}
Solution 2: Use Explicit Implementation to Wrap Static Logic
If you want to keep the method static (perhaps to allow MathUtils.Add(1, 2) calls elsewhere without creating an object), you can keep the static method and add a separate Explicit Interface Implementation that forwards the call.
Solution:
public class MathUtils : ICalculator
{
// 1. Keep your static logic
public static int Add(int a, int b)
{
return a + b;
}
// 2. Implement the interface explicitly
// This instance method acts as a bridge to the static method.
int ICalculator.Add(int a, int b)
{
// Forward the call
return MathUtils.Add(a, b);
}
}
public class Program
{
static void Main()
{
// Usage 1: Static call
int sum1 = MathUtils.Add(5, 5);
// Usage 2: Interface call
ICalculator calc = new MathUtils();
int sum2 = calc.Add(5, 5);
}
}
Conclusion
CS0736 prevents you from breaking the object-oriented contract of an interface.
- Check the Interface: Does it define a standard member (e.g.,
void Method())? - Check the Implementation: Is your method
static? - Decide:
- Remove
static: If the method exists primarily to satisfy the interface. - Wrapper: If you need the static method for other reasons, create an explicit interface implementation that calls your static method.
- Remove