Skip to content

How to Resolve Error "CS0736: Member does not implement instance interface member because it is static" in C#

Fix the CS0736 compiler error in C# when a static method conflicts with an interface's instance-based contract, including solutions like removing static or using explicit interface implementation.

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(); implies myObject.Run();.
  • Static Implementation: static void Run() implies MyClass.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.

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.

  1. Check the Interface: Does it define a standard member (e.g., void Method())?
  2. Check the Implementation: Is your method static?
  3. 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.
Navigation