ArrayList 数组链表

   System.Collections;
      是一个数组链表,具有数组的功能,也有链表的特色。

View Code
 1 using System;
 2 using System.Collections.Generic;
 3 public class StudyList1
 4 {
 5     public static void Main()
 6     {
 7         List<IWuDang> list = new List<IWuDang>();
 8         list.Add(new People(){Name = "one"});
 9         list.Add(new People(){Name = "two"});
10         list.Add(new People(){Name = "three"});
11         list.Add(new People(){Name = "four"});
12         foreach(IWuDang p in list)
13         {
14             p.GongFu();
15         }
16 
17         
18     }
19 }
20 public interface IWuDang
21 {
22     void GongFu();
23 }
24 public class People:IWuDang
25 {
26     private string name = "";
27     public string Name
28     {
29         get{return this.name;}
30         set{this.name = value;}
31     }
32     public void print()
33     {
34         Console.WriteLine(this.name);
35     }
36     public void GongFu()
37     {
38         Console.WriteLine("太极");
39     }
40 }

 

posted @ 2012-08-04 14:58  妍珊  阅读(523)  评论(0编辑  收藏  举报