Alpesh Maniya
How do you handle scenarios in C# when you have the same method name defined in two interfaces, and you inherit both of these interfaces in a single class?

Provide a detailed explanation of the approach to differentiate and implement the methods from each interface in the class, ensuring that the correct implementation is invoked when calling these methods.

By Alpesh Maniya in C# on Jan 18 2024
  • Wasim Hajwane
    Feb, 2024 16

    You can solved the problem using explicit interface,
    So if two interface having same method name, SO in this case when a class implement two interface, we provide the implementation using interace name dot method name.

    • 1
  • Kaminm
    Jan, 2024 25

    use explicit Interface Implementation interface.method

    • 0
  • Akhil P
    Jan, 2024 21

    Using Explicit Interface Implementation we can solve your scenarioClass A : I1, I2{ public void I1.doSomething(); public void !2.doSomething(); }

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS