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 }

 

相关文章:

  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
  • 2020-06-06
  • 2021-10-02
  • 2021-12-17
  • 2021-07-07
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2020-10-20
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案