版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/a1057962851/article/details/84726848
定义事件 public delegate void RaiseEventHandler(string hand); public delegate void FallEventHandler();
类中定义子程序指向事件public
public class A public event RaiseEventHandler RaiseEvent; public event FallEventHandler FallEvent;
用户执行代码子程序内进行调用比如
RaiseEvent(string 小者最牛逼)
其他类中子程序进行委托 比如
类的名字 a=new 类的名字();
a.RaiseEnent += 需要执行的子程序比如(weituo)
public weituo(string xiaozhezuiniubi)
{
console.log(xiaozhezuiniubi)
}