ArrayList arrayList = new ArrayList();
            arrayList.Add("1");
            arrayList.Add("1");
            arrayList.Add("2");
            arrayList.Add("2");
            arrayList.Add("3");
            arrayList.Add("3");
            arrayList.Add("4");
            arrayList.Add("5");           
            arrayList.Add("4");
            arrayList.Add("5");
            //删除重复数据
            for (int i = 0; i < arrayList.Count; i++)
            {
                for (int j = i + 1; j < arrayList.Count; j++)
                {
                    if (arrayList[i].Equals(arrayList[j]))
                    {
                        arrayList.RemoveAt(j);
                        if (i > 0)
                        {
                            i--;
                        }
                    }
                }
            }

posted on 2009-06-10 14:54  8user  阅读(2933)  评论(0编辑  收藏  举报