因为数组不能复制,所以无法编写使用数组类型形参的函数。
Because we cannot copy an array, we cannot write a function that takes an array type parameter.
在泛型接口或委托中,如果类型形参仅用作方法返回类型,而不用于方法实参,则可声明为协变的。
A type can be declared contravariant in a generic interface or delegate if it is used only as a type of method arguments and not used as a method return type.
如果接口具有逆变类型形参,则允许其方法接受与接口类型形参指定的派生类型相比,派生程度更小的类型的实参。
An interface that has a contravariant type parameter allows its methods to accept arguments of less derived types than those specified by the interface type parameter.
应用推荐