public static T Get<T>(T t) where T:People,Man,new() //where T:class //引用类型约束 //where T:struct//值类型约束 //where T:new()//无参数构造函数约束 { return t; }
泛型约束不能是密封类。
泛型约束形式
原文:https://www.cnblogs.com/flywing/p/10497000.html