C#中數組、集合 、泛型集合 、字典 全面對比

因爲

1. 數組的使用不方便,所以有了集合(ArrayList)。

2.因爲集合(ArrayList)的不安全和消耗性能所以有了泛型集合(list<T>).這就是這3者的關係——彌補缺點。

3.至於字典這個因爲它也是儲蓄一組數據的集合,同時用到了泛型 

//數組
string[] m_Str = new string[5];
//集合
ArrayList m_AList = new ArrayList();
//泛型集合
List<int> m_List = new List<int>();
//字典
Dictionary<int, string> m_Dt = new Dictionary<int, string>();

https://www.cnblogs.com/JK1989/p/6679523.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章