Dynamically constructing types : Type : Reflection C# Examples


C# Examples » Reflection » Type »

 

Dynamically constructing types









    
using  System;
using  System.Collections.Generic;
using  System.Text;
using  System.Threading;
using  System.Reflection;
using  System.Reflection.Emit;

public  class  MainClass
{
        public  static  void  Main()
        {
                Type  listType  =  typeof(List<>);
                Type  listOfIntType  =  listType.MakeGenericType(typeof(int));
                Console.WriteLine(listOfIntType.FullName);
        }
}
    
   
  
   



Output

System.Collections.Generic.List`1[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicK
eyToken=b77a5c561934e089]]


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Reflection
» Type