I\'m having some trouble getting my head around casting an interface I\'ve come up with. It\'s an MVP design for C# Windows Forms. I have an IView class which I implement o
CPresenter is not an IPresenter, just as List is not an IList.
Think about it. If you could get an IList reference to a List, you could add a string[] to it, which would have to throw an exception. The whole point of static type checking is to prevent the compilation of such code.
If the interface allows, you could declare the type parameter as covariant (IPresenter. Then the interface would behave more like IEnumerable. This is only possible if the type parameter is never used in an input position.
To go back to the List example, it is safe to treat it as an IEnumerable, because you can't add anything to an IEnumerable reference; you can only read things out of it, and, in turn, it is safe to treat an int[] as an IEnumerable, so all is well.