实现Ilist接口的类
类:

1
 using System;
using System;2
 using System.Collections;
using System.Collections;3

4
 namespace Relaction.Collections
namespace Relaction.Collections5
 {
{6
 /// <summary>
    /// <summary>7
 /// MyList 的摘要说明。
    /// MyList 的摘要说明。8
 /// </summary>
    /// </summary>9
 public class MyList:IList
    public class MyList:IList10
 {
    {11
 private ArrayList _list;
        private ArrayList _list;12
 public MyList()
        public MyList()13
 {
        {14
 _list = new ArrayList();
            _list = new ArrayList();15
 }
        }16
 IList 成员
        IList 成员82

83
 ICollection 成员
        ICollection 成员115

116
 IEnumerable 成员
        IEnumerable 成员124
 }
    }125
 }
}
客户:

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


 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号