Keyur Patel
I have two interfaces with methods having same names and parameters. In a class, i implements these two interfaces. How can i call it?
By Keyur Patel in C# on Apr 16 2013
  • senthilkumar ananthan
    Jul, 2013 12

    For Example, If you are having two interfaces are named as,public interface IA { void XYZ(); }public interface IB { void XYZ(); }And you can implement these two interfaces in a class as below,public class C1 { public void IA.XYZ() { //something IA }public void IB.XYZ() { //something IB } }Now you can call these methods as below,IA obj1 = new C1(); IB obj2 = new C1();obj1.XYZ(); // calls the method of interface IAobj2.XYZ(); // calls the method of interface IB

    • 1
  • mangesh kudalkar
    Jun, 2013 17

    1. implement methods with filly qualified name e.g. I1.GetdEscription() where I1 is the interface2. You need to explicitly cast your call instance to the interface you want to call and call the method

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS