|
发表于 2020-6-30 08:30:01
|
显示全部楼层
C#的泛型啦
<T>表示类表中的类型
可以用AarryList代替,eg:
AarryList list=new AarryList();
List.Add(1);
List.Add(2);
和
List<int> list=new List<int>();
List.Add(1);
List.Add(2);
是一样的
只是转换的时候有差别:
泛型不用转换,如要取List[0]
int i=List[0];
而AarryList:
int i=(int)List[0]; |
|