Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

32 lines
431 B
C#

// Generic delegates.
using System;
delegate void Test<T> (T t);
class Foo<T>
{
public event Test<T> MyEvent;
public void Hello (T t)
{
if (MyEvent != null)
MyEvent (t);
}
}
class X
{
static void do_hello (string hello)
{
Console.WriteLine ("Hello: {0}", hello);
}
public static void Main ()
{
Foo<string> foo = new Foo<string> ();
foo.MyEvent += new Test<string> (do_hello);
foo.Hello ("Boston");
}
}