class Test
{
public delegate void FruitDelegate(Fruit f);
public void Notify(Action del) where T : Fruit
{
FruitDelegate f = d
is this what you want?
static void Main(string[] args)
{
Program p = new Program();
p.SomeMethod();
}
public class Fruit
{ }
public class Apple : Fruit { }
public delegate void FruitDelegate(T f) where T : Fruit;
class Test
{
public static void Notify(FruitDelegate del)
where T : Fruit, new()
{
T t = new T();
del.DynamicInvoke(t);
}
}
private void AppleHandler(Apple apple)
{
Console.WriteLine(apple.GetType().FullName);
}
public void SomeMethod()
{
FruitDelegate del = new FruitDelegate(AppleHandler);
Test.Notify(del);
}