Implicit reference conversions
The implicit reference conversions are: · From any reference-type to object and dynamic. · From any class-type S to any class-type T, provided S is derived from T. · From any class-type S to any interface-type T, provided S implements T. · From any interface-type S to any interface-type T, provided S is derived from T. · From an array-type S with an element type SE to an array-type T with an element type TE, provided all of the following are true: o S and T differ only in element type. In other words, S and T have the same number of dimensions. o Both SE and TE are reference-types. o An implicit reference conversion exists from SE to TE. · From any array-type to System.Array and the interfaces it implements. · From a single-dimensional array type S[] to System.Collections.Generic.IList<T> and its base interfaces, provided that there is an implicit identity or reference conversion from S to T. · From any delegate-type to System.Delegate and the interfaces it implements. · From the null literal to any reference-type. · From any reference-type to a reference-type T if it has an implicit identity or reference conversion to a reference-type T0 and T0 has an identity conversion to T. · From any reference-type to an interface or delegate type T if it has an implicit identity or reference conversion to an interface or delegate type T0 and T0 is variance-convertible (§13.1.3.2) to T. · Implicit conversions involving type parameters that are known to be reference types. See §6.1.10 for more details on implicit conversions involving type parameters. The implicit reference conversions are those conversions between reference-types that can be proven to always succeed, and therefore require no checks at run-time. Reference conversions, implicit or explicit, never change the referential identity of the object being converted. In other words, while a reference conversion may change the type of the reference, it never changes the type or value of the object being referred to.
|