泛型为开发者提供了一种高性能的编程方式,能够提高代码的重用性,并且让开发者编写非常优雅的程序。
public class MyGenerics<T, U, V>
MyGenerics
<intstringobject> x = new MyGenerics<intstringobject>();

泛型参数的约束
1:where T:struct    规定T必须是一个值类型
2:where T:class     规定T必须是一个引用类型,包括任何类、委托或接口
3:where T:new()     规定T必须实现一个默认的构造器new(),如果同一个类型上有多个约束,new()约束必须最后指定
4:where T:(base class)    规定T必须是指定的基类或基类的派生类
5:where T:(interface)     规定T必须是指定接口类型或接口实现
public class MyGenerics<T, U, V> where U:class,new() where V:IComparable
U必须是引用类型而且要有默认构造器,V是接口IComparable的类型。