aList.Remove("a");
结果为b c d e
2. public virtual void RemoveAt(int index);
移除 ArrayList 的指定索引处的元素
aList.Add("a");
aList.Add("b");
aList.Add("c");
aList.Add("d");
aList.Add("e");
aList.RemoveAt(0);
3. public virtual void RemoveRange(int index,int count);
从 ArrayList 中移除一定范围的元素。
Index表示索引,count表示从索引处开始的数目
aList.RemoveRange(1,3);
结果为a e
4. public virtual void Clear();
从 ArrayList 中移除所有元素。
五.排序
a) public virtual void Sort();
对 ArrayList 或它的一部分中的元素进行排序。
ArrayList aList = new ArrayList();
DropDownList1.DataSource = aList; // DropDownList DropDownList1;
DropDownList1.DataBind();
结果为e a b c d
aList.Sort(); //排序
结果为a b c d e
b) public virtual void Reverse();
上一页 [1] [2] [3] [4] 下一页
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18