1、          先初始化一个数组<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

object [] objarr=new object [0];

2、          仿照ArrayList见三个构造函数

public MyArrayList()

        {

        }

        public MyArrayList(int Cap)// 容量

        {

          objarr =new object [Cap ];

        }

        public MyArrayList(ICollection con)// 定义非泛型集合大小

        {

          objarr =new object [con.Count ];

          con.CopyTo(objarr, 0);

       }

3、         创建索引器

public object this[int i]//This 指实例化的对象,[int i]

            {                                数组下表

            get

            {

                return objarr[i];

            }

          

            set

            {

                objarr[i] = value;

            }

 }

4、         写方法,例如添加移除等

public int   Add(object o)

        {

 object[] tem = new object[objarr.Length + 1];

            objarr.CopyTo(tem, 0);

            tem[tem.Length - 1] = o;

            objarr = tem;

            return tem.Length -1;

 

        }