Why interface cannot have static method – C#

We cannot have a static method inside an interface, like below:

public interface Foo 
{
    public static int bar(); // compile time error
}

This will be a compile time Error saying:

The modifier ‘static’ is not valid for this item

 

The reason why you can’t have a static method in an interface is the way C# resolves the static references.

C# will not look for an instance of a class when attempting to execute a static method, because static methods are not instance dependent and hence can be executed straight from the class.


We Know that every method in an interface is implicitly abstract, and by abstract we mean “Implements no functionality”.

By static we mean “There is functionality even if you do not have an instance”
and instance of an interface cannot be made.

 

So due to this logical contradiction, we can say that static and abstract is an invalid and illegal Combination.