Generic Anonymous Methods : Generic delegate « Generics « C# / C Sharp






Generic Anonymous Methods

 

public delegate void ADelegate<T>(T tvalue);

public class MyClass{
    public void MethodA() {
        ADelegate<int> del=delegate(int var) {
        };
    }
}

public class YClass<T>{
    public delegate void BDelegate(T tValue);
    public void MethodA() {
        BDelegate del=delegate(T tValue) {
        };
    }
}

 








Related examples in the same category

1.A simple generic delegateA simple generic delegate
2.Convert event to use generic delegateConvert event to use generic delegate
3.Generic Delegate and non-generic delegate
4.Generics and Delegates
5.a generic delegate being initialized with a normal method