public voidmain()
{//可以存储任何类型的数组
ArrayList alist = newArrayList();
AddData(alist);
RemoveData(alist);
UpdateData(alist);
SearchData(alist);
OtherFun(alist);
}///
///往集合加数据///
///
public voidAddData(ArrayList alist)
{
alist.Add(0);
alist.Add(1.1);
alist.Add("test");
alist.Add(true);
alist.Add(new int[] { 1, 2 }); //增加一个数组,增加了1个//批量添加
alist.AddRange(new int[] { 1, 2 });//匹配增加一个数据,增加了2个
alist.AddRange(new List() { "test1", "test2"});
alist.Insert(1, "test3");
}///
///移除集合数据///
///
public voidRemoveData(ArrayList alist)
{//移除:
alist.Remove(0);
alist.RemoveAt(1);
alist.RemoveRange(1, 2);
}///
///修改集合数据///
/// <