public void arrays_of_reference_types_use_contravariant_assignment() { var lesses = new LessSpecific[1]; object[] objects = lesses; // contra variant throught unsafe up-cast objects[0] = new LessSpecific(); }
public void arrays_of_reference_types_use_unsafe_contravariant_assignment() { var mores = new MoreSpecific[1]; object[] objects = mores; // compiletime contra-variance, but failing in runtime objects[0] = new LessSpecific(); }
public void arrays_of_reference_types_are_unsafely_contravariant() { var less = new LessSpecific[] {}; object[] obj = less; // runtime error here var more = (MoreSpecific[]) obj; }
public void reference_types_are_unsafely_contravariant() { var less = new LessSpecific(); object obj = less; // runtime error here var more = (MoreSpecific) obj; }