Type.MakeGenericType : Type « System « C# / C Sharp by API






Type.MakeGenericType

    
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);
    }
}

   
    
    
    
  








Related examples in the same category

1.Type.BaseType
2.Type.ContainsGenericParameters
3.Type.FullName
4.Type.GetConstructor
5.Type.GetCustomAttributes
6.Type.GetEvents()
7.Type.GetFields()
8.Type.GetGenericArguments()
9.Type.GetGenericTypeDefinition()
10.Type.GetInterfaces()
11.Type.GetMethod(String methodName);
12.Type.GetMethods()
13.Type.GetProperties()
14.Type.GetType(String typeName)
15.Type.GetType(String typeName, true)
16.Type.GetType(String typeName, true, true);
17.Type.IsAbstract
18.Type.IsClass
19.Type.IsCOMObject
20.Type.IsEnum
21.Type.IsGenericTypeDefinition
22.Type.IsSealed
23.Type.Name
24.Type.ReflectionOnlyGetType
25.Type.UnderlyingSystemType