.NET - Delegate得到委托的调用列表

 

 1 using System;
 2 using System.Collections.Generic;
 3 using System.ComponentModel;
 4 using System.Data;
 5 using System.Drawing;
 6 using System.Text;
 7 using System.Windows.Forms;
 8 
 9 namespace TEST
10 {
11     public delegate void MyEventHandler();
12 
13     public partial class Form1 : Form
14     {
15         public event MyEventHandler myEvent; 
16 
17         public Form1()
18         {
19             InitializeComponent();
20         }
21 
22         private void button1_Click(object sender, EventArgs e)
23         {
24             myEvent += GetMY;
25 
26             foreach (Delegate d in myEvent.GetInvocationList())
27             {
28                 string ds = d.Method.Name;
29             }
30         }
31 
32         public void GetMY()
33         {
34         }
35     }
36 }
posted @ 2008-08-26 16:47  许晓光  阅读(157)  评论(0)    收藏  举报