实现Ilist接口的类

类:


  1using System;
  2using System.Collections;
  3
  4namespace Relaction.Collections
  5{
  6    /// <summary>
  7    /// MyList 的摘要说明。
  8    /// </summary>

  9    public class MyList:IList
 10    {
 11        private ArrayList _list;
 12        public MyList()
 13        {
 14            _list = new ArrayList();
 15        }

 16        IList 成员
 82
 83        ICollection 成员
115
116        IEnumerable 成员
124    }

125}


客户:


 1    private void button8_Click(object sender, System.EventArgs e)
 2        {
 3            Relaction.Collections.MyList list = new Relaction.Collections.MyList();
 4            list.Add(1);
 5            list.Add(2);
 6            for(int i =0;i<list.Count;i++)
 7            {
 8                label1.Text += list[i].ToString();
 9            }

10        }
posted @ 2007-08-06 09:52  利利新书  阅读(831)  评论(0)    收藏  举报