using System;
using System.Collections.Generic;
using System.Collections;//要用能动态数组,就需自己再导入命名空间
using System.Linq;
using System.Text;
//using System.Collections;
namespace listremove
{
/// <summary>
/// 删除数组指定元素。
/// </summary>
class Program
{
static void Main(string[] args)
{
ArrayList myArrayList = new System.Collections.ArrayList();
myArrayList.Add(1);
myArrayList.Add(2);
myArrayList.Add(3);
myArrayList.Add(4);
myArrayList.Add(5);
myArrayList.RemoveAt(3);///删除第四个元素。
myArrayList.Remove(1);///删除等于1的元素。
for (int i = 0; i < myArrayList.Count; i++)
{
Console.Write("{0} ", myArrayList[i]);
}
Console.ReadLine();
}
}
}