class Program
{
static void showSatic(string ss)
{
Console.WriteLine("~~~~~~~showSatic" + ss);
}
static void Main(string[] args)
{
Test t = new Test();
//注册委托事件
t.show1 = Program.showSatic;
t.show2("测试");
Console.Read();
}
}
class Test
{
//声明一个delegate type
public delegate void showMSG(string str);
//声明一个对象
public showMSG show1;
public void show2(string s)
{
show1.Invoke(s);
}
}

被折叠的 条评论
为什么被折叠?



