Type generic = typeof(List<>);
Type specific = generic.MakeGenericType(typeof(int));
ConstructorInfo ci = specific.GetConstructor(Type.EmptyTypes);
object o = ci.Invoke(new object[] { });
More Related Contents:
- Generics and casting – cannot cast inherited class to base class
- Value of type ‘T’ cannot be converted to
- implicit operator using interfaces
- Generics: casting and value types, why is this illegal?
- Why can’t I cast from a List to List?
- Cast Int to Generic Enum in C#
- .NET Casting Generic List
- Casting array to IEnumerable
- Casting vs using the ‘as’ keyword in the CLR
- execute c# code at runtime from code file
- Shorter syntax for casting from a List to a List?
- C# use System.Type as Generic parameter
- How to call .NET methods from Excel VBA?
- How to initialize a List to a given size (as opposed to capacity)?
- Calling a generic method with a dynamic type [duplicate]
- Why cannot IEnumerable be cast as IEnumerable?
- Collection of generic types
- Is there a C# generic constraint for “real number” types? [duplicate]
- Why does IEnumerator inherit from IDisposable while the non-generic IEnumerator does not?
- Generic methods and method overloading
- Why can’t Double be implicitly cast to Decimal
- Create object instance of a class from its name in string variable
- Can I have a variable number of generic parameters?
- What is the equivalent of Java wildcards in C# generics
- C# – Issues with boxing / unboxing / typecasting ints. I don’t understand
- Overload resolution issue for generic method with constraints
- Are static members of a generic class tied to the specific instance?
- How to constrain generic type to must have a construtor that takes certain parameters?
- How to write this EF Mock setup code as a reusable Generic Boilerplate?
- .NET Managing Layers Relationships