4,是不是得实现一个或者多个泛型接口(generic interfaces).例如:如果你正在设计一个类,它会被用来创建items,而且这些item的类型不定,那么你就有必要去实现一个ICompareable 基于32个网页-相关网页
... System.Collections.Generic 命名空间 IDictionary 泛型接口 Dictionary.Enumerator 泛型结构 ...
基于16个网页-相关网页
·2,447,543篇论文数据,部分数据来源于NoteExpress
首先从定义存储库的泛型接口开始。
泛型接口不要定义限制。接口层的限制通常能用强类型代替。
Do not define constraints in generic interfaces. Interface level-constraint can often be replaced by strong-typing.
在泛型接口或委托中,如果类型形参仅用作方法返回类型,而不用于方法实参,则可声明为协变的。
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.
应用推荐