现在的位置: 首页 > 综合 > 正文

实现Ilist接口的类

2013年07月28日 ⁄ 综合 ⁄ 共 2901字 ⁄ 字号 评论关闭

类:


  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        }

抱歉!评论已关闭.