What is explicit and implicit interface and in which condition we should use ?
Dinesh Kumar
Let's say your one class -> implement two interface (I1 and I2 - having same method name A() )-> it can create conflicts with your requirements-> so to overcome this instead of implicit interface you use explicit interface.For using explicit interface -> you need to add fully qualified method name with interface in your class.For ex instead of using only A() you need to write I1.A() in your class
In simple words, When you implement the member of the interface in the class without specifying the interface name, then it's called as Implicit interface implementation. On the other side, if you are creating the object of interface then calling it's method then it's explicit implementation.Below is the simple example which explains the same.interface ITest{void TestMethod();}class TestClass: ITest{public void TestMethod(){Console.WriteLine("Implicit Interface Implementation");}void ITest.TestMethod(){Console.WriteLine("Explicit Interface Implementation");}}class Program{static void Main(string[] args){TestClass obj = new TestClass();obj.TestMethod(); //Way to call implicitely implemented methodITest obj2 = new TestClass();obj2.TestMethod();Console.ReadLine();}}Just to add the constraint with explicit implementation is that explicitly implemented member cannot be accessed through a class instance, but only through an instance of the interface. You can see the same in example above.
Implementing interface members with interface name is called explicit interface where as without interface name is called implicit interface.In common situation we use implicit interface. But when a class implement 2 or more interface having same method signature at that moment we use explicit interface.
When you implement the some member of interface in your class without specifying your interface name that is called implicit interface else if you implement the some member of interface in your class with their fully qualified path means interface name and method name with dot this is called explicit interface
When the Interface methods are publicly declared they are called Explicit interfaces; where as when the interface methods are declared privately, they are said to be implicit Interfaces
https://msdn.microsoft.com/en-us/library/aa288461(v=vs.71).aspx
In Implicit interface we simply inherit the method of a Interface with out using interface name but when use a interface name before method name in abstract class then it is known as Explicit interface . An Explicit interface we can not call method of a interface using class object .. We should be create a instance of Interface that will hold a reference of class object
http://www.c-sharpcorner.com/UploadFile/8911c4/implicit-and-explicit-interface-examples/