摘要: where 子句用于指定类型约束,这些约束可以作为泛型声明中定义的类型参数的变量。 1.接口约束。 例如,可以声明一个泛型类 MyGenericClass,这样,类型参数 T 就可以实现 IComparable<T> 接口: public class MyGenericClass<T> where 阅读全文
posted @ 2020-03-27 10:58 风雪江山 阅读(3203) 评论(0) 推荐(0) 编辑