Output the type information about the generic parameters : Generic Type : Generics C# Source Code


Custom Search

C# Source Code » Generics » Generic Type »

 

Output the type information about the generic parameters








    
 


using System;
using System.Collections.Generic;
using System.Text;

public class OneParamType<T> {}

public class TwoParamType<T, U> {}

public class TypeDumper<T, U, V> {
    public static void DumpTypeInfo() {
        Console.WriteLine(typeof(T));
        Console.WriteLine(typeof(U));
        Console.WriteLine(typeof(V));
        Console.WriteLine(typeof(OneParamType<String>));
        Console.WriteLine(typeof(OneParamType<T>));
        Console.WriteLine(typeof(TwoParamType<U, int>));
        Console.WriteLine(typeof(TwoParamType<T, V>));
    }

    public static void ShowTypeInfo() {
        TypeDumper<String, int, Double>.DumpTypeInfo();
    }    
}

          
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Generics
» Generic Type