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);
}
}
|
HTML code for linking to this page:
Related in same category :
-
-
-
|