Top "Covariance" questions

Covariance, contravariance and invariance describe how the existing type inheritance hierarchy changes when subjected to some transformation (such as usage within generics).

Make dictionary read only in C#

I have a Dictionary<string, List<string>> and would like to expose the member as read …

c# collections covariance
Generics : List<? extends Animal> is same as List<Animal>?

I am just trying to understand the extends keyword in Java Generics. List<? extends Animal> means we can …

java generics covariance extends contravariance
Covariance, Invariance and Contravariance explained in plain English?

Today, I read some articles about Covariance, Contravariance (and Invariance) in Java. I read the English and German Wikipedia article, …

java covariance contravariance
Co-variant array conversion from x to y may cause run-time exception

I have a private readonly list of LinkLabels (IList<LinkLabel>). I later add LinkLabels to this list and …

c# winforms .net-4.0 covariance
Why doesn't the example compile, aka how does (co-, contra-, and in-) variance work?

Following on from this question, can someone explain the following in Scala: class Slot[+T] (var some: T) { // DOES NOT …

generics scala covariance contravariance
Difference between Covariance & Contra-variance

I am having trouble understanding the difference between covariance and contravariance.

c# c#-4.0 covariance contravariance
Can I Override with derived types?

As far as i know it is not possible to do the following in C# 2.0 public class Father { public virtual …

c# .net inheritance covariance
Why isn't `curve_fit` able to estimate the covariance of the parameter if the parameter fits exactly?

I don't understand curve_fit isn't able to estimate the covariance of the parameter, thus raising the OptimizeWarning below. The …

python numpy scipy curve-fitting covariance
Understanding Covariant and Contravariant interfaces in C#

I've come across these in a textbook I am reading on C#, but I am having difficulty understanding them, probably …

c# .net interface covariance contravariance
Why can't I cast from a List<MyClass> to List<object>?

I have a List of objects, which are of my type QuoteHeader and I want to pass this list as …

c# generics casting covariance