Generics and Delegates
using System; public delegate void DelegateClass(int data); public class Starter { public static void Main() { DelegateClass del1 = MethodA<int>; del1(5); DelegateClass del2 = MethodA; del1(10); // inferred } public static void MethodA<T>(T data) { Console.WriteLine("MethodA ({0})", data); } }
1. | A simple generic delegate | ||
2. | Convert event to use generic delegate | ||
3. | Generic Delegate and non-generic delegate | ||
4. | a generic delegate being initialized with a normal method | ||
5. | Generic Anonymous Methods |