//透視事件觸發 進而呼叫 hedler處理事件 public void StartEven() { PoliceArgs args = new PoliceArgs(); args.Name = "AAAA"; args.CurrentTime = DateTime.Now; PoliceCatchevent(this, args); }
static void Main(string[] args) { Program P = new Program(); Thief A = new Thief(); Police police = new Police(); PoliceArgs policeArgs = new PoliceArgs(); policeArgs.Name = "jason"; police.PoliceCatchevent += new Police.PoliceCatchHedler(A.thiefMethod); //police.PoliceCatchevent += new Police.PoliceCatchHedler(P.test); police.StartEven(); }
public void thiefMethod(object sender, PoliceArgs args) { Console.WriteLine("我是被委派的事件"); }