Explicit Interface in C#

Now we are going to learn about the explicit interface in C#.
  • 6824

Introduction

Generally we are Implementing the interfaces in C# programming. Use of the Explicit implementation is very limited. This problem arises at the time when two same member interfacing and working directly with interface but you are not acknowledging.

Example

 interface A
 {
 void implicitExample();
 }
 interface
B
  {
void explicitExample();
 }
class C : A,
B
 {
 void implicitExample()
 {
Console.WriteLine("A.implicitExample()");
}
void B.explicitExample()
{
Console.WriteLine("B.explicitExample()");
}
}
}


© 2020 DotNetHeaven. All rights reserved.