3
Reply

Is it possible to implement two interfaces in the same class if the interfaces have same method signature ,name,same number of methods etc.? If yes How?

    Yes. It is called Explicit Interface Implementation.

    yes you can implement method by name of interface first

    We have use the "Explicit Interface implementation" feature of C# to achieve this. For example // Declare the English units interface: interface IEnglishDimensions {float Length();float Width(); } // Declare the metric units interface: interface IMetricDimensions {float Length();float Width(); } //You can implement in the class like below class Box : IEnglishDimensions, IMetricDimensions {float lengthInches;float widthInches;public Box(float length, float width) {lengthInches = length;widthInches = width;} // Explicitly implement the members of IEnglishDimensions:float IEnglishDimensions.Length() {return lengthInches;}float IEnglishDimensions.Width() {return widthInches; } // Explicitly implement the members of IMetricDimensions:float IMetricDimensions.Length() {return lengthInches * 2.54f;}float IMetricDimensions.Width() {return widthInches * 2.54f;} }Warning : An interface member that is explicitly implemented cannot be accessed from a class instance: You have to cast it to interface type to call the method.Check this MSDN link for the full example :https://msdn.microsoft.com/en-us/library/aa288461(v=vs.71).aspx