For any two reference types A
and B
, if A
is a derived type of B
, then a conversion exists from an array of type A
to a compatible (that is, rank and type of array) array of type B
. This relationship is known as array covariance. Array covariance in particular means that an element of an array whose element type is B
may actually be an element of an array whose element type is A
, provided both A
and B
are reference types and B
is a base type of A
.
Because of array covariance, assignments to elements of reference type arrays include a runtime check that ensures that the value being assigned to the array element is actually of a permitted type. Array covariance specifically does not extend to arrays of value types.