[2020-02] Avoid following invalid pointers in mono_w32process_get_modules on Darwin...
[mono-project.git] / mono / tests / bug-479763.2.cs
blob8f1398d97614ff4e3adfe91fc87d39ec2ca32306
1 using System;
3 public class Foo
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;
18 Event += handler;
22 public static class Program
24 public static void Main()
26 var thing = new Foo();
28 thing.AddHandler<Type>("hello");
29 thing.RaiseEvent();
30 thing.AddHandler<Type>("there");