5 public event EventHandler Event
;
7 public void RaiseEvent()
9 Event(this, new EventArgs());
12 public void AddHandler
<T
>(string target
)
14 Action
<object, EventArgs
> fn
= (sender
, e
) => Console
.WriteLine(target
);
15 EventHandler handler
= Delegate
.CreateDelegate(typeof(EventHandler
),
16 fn
.Target
, fn
.Method
) as EventHandler
;
22 public static class Program
24 public static void Main()
26 var thing
= new Foo();
28 thing
.AddHandler
<Type
>("hello");
30 thing
.AddHandler
<Type
>("there");