c#集合与泛型集合
发布日期:2021-05-14 16:18:03 浏览次数:20 分类:精选文章

本文共 3449 字,大约阅读时间需要 11 分钟。

C#������������������������������������

���C#������������������������������������������������������������������������������������������������������������������������������������������������������������ArrayList���Hashtable���List���Dictionary���������������������������������������������������������������������������������������������������C#������������������������������������������������

ArrayList���Hashtable���������

ArrayList���Hashtable������C#������������������������������������������������������������������������������������������ArrayList������eneric���������������������������������������������������������������������������������������������������������������������-safe������������������������������������������������������������������������������������������������������������������������������C#������ArrayList������������������������������������

���ArrayList���������Hashtable��������������������������������������������������������������������������������������������������������������������������������������������������������� Insert���Delete ��� Retrieve ���������Hashtable���������������������������������������������������������Hashtable������������������������������������������������������������������

������List������������

C# 2.0���������������������������������������������������List������������untuition���ArrayList���������������List������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������List���������������������������������ArrayList������������������������

Dictionary���

������List������Dictionary���������C#���������������������������������������Dictionary���������������������������������������������������������������������Hashtable���������Dictionary������������������������������������������������������������������������������������������������������������������������������������������������������������Dictionary���������������������������

������������������������������������

���������������������������������������������������������������������������������������������������������ArrayList���Hashtable���������������������������������������������������������������������List���Dictionary������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������

���������������C#������������������������������

// ArrayList������
ArrayList list = new ArrayList();
list.Add("������");
list.AddRange(new string[] {"������","������","1","2","2","9" });
list.Insert(2, "���������");
list.InsertRange(2, new string[] {"���������1","���������" });
...
// Hashtable������
Hashtable ht = new Hashtable();
ht.Add("name", "���XX");
ht.Add("age", 12);
...
ht.Remove("name");
bool containsKey = ht.Contains("age"); // ������true
...
// List������������
List
list = new List
();
list.Add("������");
list.AddRange(new string[] {"������","������"});
// Dictionary������
Dictionary
dic = new Dictionary
();
dic.Add(1, "������");
dic.Add(2, "������");
dic.Remove(2); // ���������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

上一篇:接口详解
下一篇:c#的接口详解

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2025年04月06日 16时02分40秒