2013年3月22日

C# 高级编程(笔记3)

摘要: 第5章 泛型1.泛型类的静态成员 泛型类的静态成员只能在类的一个实例中共享 public class staticDemo<T> { public static int x; }由于同时对一个string类型和一个int类型使用了staticDemo<T>类,所以存在两组静态字段:staticDemo<string>.x = 4; staticDemo<int>.x = 5;Console.WriteLine(staticDemo<string>.x); //输出 42.协变和抗变:指对参数和返回值的类型进行转换假定有Shape和Re 阅读全文

posted @ 2013-03-22 22:16 Gcam 阅读(175) 评论(0) 推荐(0) 编辑

导航