1 Scenario where C# interface is indispensable?

Interview Question: Tell one scenario where C# interface is indispensable. For the scenario, only C# interface is the solution and abstract class cannot be used.

Answer: Scenario is multiple interface inheritance. C# object oriented programming does not support multiple class inheritance, means, a class cannot inherit more than one class in C#. But, a class can inherit multiple interfaces.

C# multiple inheritance


Multiple interface inheritance example in C#




Validating Credit Card
Starting transaction
Transaction completed

So, if a class has a requirement of multiple inheritance in C#, then only interfaces are solution not an abstract class.

Recommended another nice interview question that is what you would prefer between interface and abstract class in C# if both offer contracts only.