The following is a code snippet about covariance in C#. I have some understanding about how to apply covariance, but there is some detailed technical stuff that I have hard time grasping.
I'm trying to understand covariance in Scala, but I cant find any examples that help me with this problem. I' ve got this code:
I can't understand why the following C# code doesn't compile.As you can see, I have a static generic method Something with an IEnumerable<T> parameter (and T is constrained to be an IA interface), and this parameter can't be implicitly converted to IEnumerable<IA>.
I found it difficult to come up with a descriptive enough title for this scenario so I'll let the code do most of the talking.
I have an interface with a covariant type parameter:Additionally, I have a non-generic base class and another deriving from it: