摘要: Dictionary的本质 基于键的哈希代码组织起来的键值对 键值对类型从hashtable的object变成了可以自己指定的泛型 Dictionary<int,string> dictionary = new Dictionary<int,string>(); //增加 //不能出现相同键 dic 阅读全文
posted @ 2025-01-11 07:23 cannedmint 阅读(26) 评论(0) 推荐(0) 编辑
摘要: List的本质 是一个可变类型的泛型数组 List<int> list = new List<int>(); List<string> list2 = new List<string>(); //增加 list.Add(1); list2.Add("string"); List<string> li 阅读全文
posted @ 2025-01-11 06:59 cannedmint 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 泛型约束的概念 让泛型的类型有一定限制 值类型: where 泛型字母 : struct 引用类型: where 泛型字母 : class 存在无参公共构造函数: where 泛型字母 : new() 某个类本身或者其派生类: where 泛型字母 : 类名 某个接口的派生类型: where 泛型字 阅读全文
posted @ 2025-01-11 06:32 cannedmint 阅读(10) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示