Of course we can call those methods directly, but only if these methods are accessible via the reference to the class instance. The methods implementing interfaces don't have to be public, they can be explicit implementation method:
interface MyInterface {
void MyMethod();
}
class MyClass : MyInterface {
void MyInterface.MyMethod();
}
You might ask: why doing such things at all, why not implementing interfaces implicitly in all cases, using public methods? I'll answer: because it would allow you to do what you want, directly calling interface implementation methods, through the reference to the instance of implementing class. That's why, in most cases, explicit implementation shown above is better.
Are you surprised? I am telling you that the real benefit is
not to allow you to do what you want! That's right. What you want is possible, but this is bad, not always, but in most cases.
This is bad because it would defeat the purpose of the interfaces.
The interface is a powerful
abstraction device which helps you to isolate some contract from its implementation. You should understand that the
runtime type of a variable/member can be not the same as the
compile-time type. Interface types can be compile-time types only, but they can never be a runtime-types of any objects; if you will, they are always abstract, the same way as abstract types. This is the base of OOP, late binding and polymorphism. You use the common
contract with different implementations of that contract, abstracting from the implementation. And whole idea of programming is all about abstraction.
A very non-trivial point here is: interfaces provides "stronger polymorphism" than base classes. This is because a structure (a value type!) can also implement interface, not only a class, and because interfaces can use polymorphism, so the same object can participate in
two or more different polymorphic sets, throw two or more different interface references. With classes, these possibilities are totally lost. Your idea to call interface methods directly means loosing all benefits of interfaces.
Please see my past answers:
Doubts on Interfaces[
^],
POLYMORPHISM WITHOUT OVERLOADING AND OVERRRIDING IS POSSIBLE[
^],
Interfaces and Polymorphism[
^],
How to decide to choose Abstract class or an Interface[
^],
Difference between abstract class and interface if they have same no of methods and var[
^],
When we use abstract and when we use interface...?[
^].
—SA