这是类型参数约束,.NET支持的类型参数约束有以下五种: where T : struct T必须是一个结构类型 where T : class T必须是一个类(class)类型,不能是结构(structure)类型 where T : new() T必须要有一个无参构造函数 where T : NameOfBaseClass T必须继承名为NameOfBaseClass的类 where T : NameOfInterface T必须实现名为NameOfInterface的接口
class A<T> where T:class 这个泛型类中的Where T:class什么意思
最新推荐文章于 2023-04-25 12:31:14 发布
本文介绍了.NET中五种类型参数约束的基本概念及其使用方式:结构类型约束、类类型约束、无参构造函数约束、基类约束及接口约束。
7903

被折叠的 条评论
为什么被折叠?



