public void WithNameShout() { Console.WriteLine("喵喵!我{0}大魔王又来了!", name); //if (WithNameShoutToMouse != null) // WithNameShoutToMouse(); CatShoutEventArgs eventArgs = new CatShoutEventArgs(); eventArgs.Name = name; WithNameShoutToMouse?.Invoke(this, eventArgs);//简化写法 }
public void Run(object other, CatShoutEventArgs e) { Console.WriteLine("{0}又来了,我{1}先跑一步啦,从阁楼跑~", e.Name, name); }