Consider the following code:
abstract class Foo
where T : Foo, new()
{
void Test()
{
if(Bar != null)
Bar(th
delegate void Bar(Foo foo) where T : Foo, new();
It works great. I tested it.
here is the test code
public abstract class Foo where T :Foo {
public event Bar Bar;
public void Test ()
{
if (Bar != null)
{
Bar (this);
}
}
}
public class FooWorld : Foo {
}
public delegate void Bar(Foo foo) where T : Foo;
class MainClass
{
public static void Main (string[] args)
{
FooWorld fw = new FooWorld ();
fw.Bar += delegate(Foo foo) {
Console.WriteLine ("Bar response to {0}", foo);
};
fw.Test ();
}
}