linux-packaging-mono/mcs/tests/test-anon-136.cs
Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

40 lines
536 B
C#

using System;
delegate void Handler<T> (object sender);
interface IBar<T> {
event Handler<T> Handler;
}
class Foo<T> {
IBar<T> proxy, real;
event Handler<T> handler;
Handler<T> proxyHandler;
public event Handler<T> Handler {
add {
if (handler == null) {
if (proxyHandler == null)
proxyHandler = (object s) => handler (proxy);
}
handler += value;
}
remove {
handler -= value;
}
}
}
class Program {
public static int Main ()
{
var x = new Foo<int> ();
x.Handler += null;
return 0;
}
}