C#中collection,list,map的使用

Iterator的使用,ArrayList的遍历

paramList是一个ArrayList

IEnumerator ie = paramList.GetEnumerator();
            while(ie.MoveNext())
            {
                NameValuePair localNameValuePair=(NameValuePair)ie.Current;
                localHashMap.Add(localNameValuePair.getName(), localNameValuePair);
                nameArrayList.Add(localNameValuePair.getName());
            }

 

 

//HashTable排序和遍历
        public void sortHashTable() 
        {
            Hashtable ht = new Hashtable();
            ht.Add("c", "3");
            ht.Add("a", "1");
            ht.Add("e", "5");
            ht.Add("b", "2");
            ht.Add("d", "4");
            //内部有默认排序机制ascii码递增
            foreach (String str 

你可能感兴趣的:(C#中collection,list,map的使用)