In Visual Studio I can right-click on an interface and choose to Implement Interface, or Implement Interface Explicitly.



public class Test : ITest
{
    public string Id // Generated by Implement Interface
    {
        get { throw new NotImplementedException(); }
    }

    string ITest.Id // Generated by Implement Interface Explicitly
    {
        get { throw new NotImplementedException(); }
    }
}


The only difference I see between the two is that the Interface name is added to the interface properties and methods when they're created if you choose to Implement Interface Explicitly.

I find it makes the code a bit more readable since I can see where that method/property comes from, however does this make any difference in how the class is used or compiled? And does it really matter if I implement my interfaces implicitly or explicitly?

Check out the top answer from Andrew Barrett for "implicit vs explicit interface implementation" on SO.

Basically:


Implicit: you access the interface methods and properties as if they were part of the class.
Explicit: you can only access methods and properties when treating the class as the implemented interface.


Code examples:

Implicit:

Test t = new Test();
t.Id; // OK
((ITest)t).Id; // OK


Explicit:

Test t = new Test();
t.Id; // Not OK
((ITest)t).Id; // OK


In terms of "when" you have to implement an interface explicitly, it is when your class already has a method with the same signature as one of the methods of your interface, or when your class implements several interfaces that share methods with the same signatures but incompatible contracts.
