Generics and Delegates : Generic delegate : Generics C# Source Code


Custom Search

C# Source Code » Generics » Generic delegate »

 

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:

Follow Navioo On Twitter

C# Source Code

 Navioo Generics
» Generic delegate