My understanding of ISP is that the client in the definition (see below) can mean either a class that implements the interface or an instance declared with 1 of the various interface options, based on client mentioned in Wikipedia definition:The interface-segregation principle (ISP) states that no client should be forced to depend on methods it does not use. [source]I've seen some SE posts that say it is when the instance is used, and others saying when the interface is implemented. According to this SE answer it can be considered both. So I'm going to continue onto the question with the assumption in mind that it can be either.Let's say that for the particular architecture I am building it is going to have 1 class implementing all the interfaces, but I want the the instance to be looked at in a flexible way when the instance is used.public interface IAutoToggle{    IEnumerable<IToggleable> Toggle(IAttribute attribute);}public interface IManualToggle{    void Toggle(IEnumerable<IToggleable> toggles);}public interface IMixedToggle: IAutoToggle, IManualToggle {}public class Toggler : IMixedToggle{    //...implementations}Now, when instantiated it can be decided whether to do 1 of the 2 or both:IMixedToggler mixedToggler = new Toggler();//orIAutoToggler autoToggler = new Toggler();//orIManual manualToggler = new Toggler();Does this way of doing things still follow the Interface-segregation principle?If it does, is there a way to do this same effect in C# without having that extra inherited interface? For example Objective-C, being a more dynamic language allows you to do something like this if I'm not mistaken:id<IAutoToggle, IManualToggle> toggler = [[Toggler alloc] init];Is there a way to avoid the extra IMixedToggle interface in C# (like done above in Objective-C)? Or are there good reasons to not go down the path I'm doing?
Does C# have a way to use a multi-interface declared instance, or something similar when applying ISP?
c#;objective c;solid
Does this way of doing things still follow the Interface-segregation principle?This is fine and does not break the ISP.is there a way to do this same effect in C# without having that extra inherited interface?You don't need it.  Instead ofpublic interface IMixedToggle: IAutoToggle, IManualToggle {}public class Toggler : IMixedToggle{    //...implementations}you can just writepublic class Toggler : IAutoToggle, IManualToggle{    //...implementations}When you use the class, depending on which interface you need, you would instantiate it asIAutoToggle o = container.Resolve<IAutoToggle>();orIManualToggle o = container.Resolve<IManualToggle>();Depending on how your factory is configured, it is quite possible the factory will return the same concrete instance to both calls. But it doesn't have to, because we are following the ISP.Now if you have a piece of code that actually depends on the fact that the same object implements both interfaces at the same time... well... that would violate the ISP. The factory should be able to supply any old object that implements the interface without impacting the calling code.