/* generics in C#: generic classes carry type info at runtime. */ using System; using System.Collections.Generic; public class pain where B:A { void f() { object[] a = new string[10]; //covariant arrays, same as java (mistake) // But why won't the following compile? // A[] b = new B[10]; // generic arrays are instances IList // and in this interface T is INVARIANT (not in or out). IList n = new object[10]; // ok IList m = new string[10]; // ok? //IList mm = new B[10]; IList mmm = new List(); } } public class nopain { public static void Main() { } }