Click or drag to resize
TypeMakeGenericType Method
Substitutes the elements of an array of types for the type parameters of the current generic type definition and returns a Type object representing the resulting constructed type.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public virtual Type MakeGenericType(
	params Type[] typeArguments
)

Parameters

typeArguments
Type: SystemType
An array of types to be substituted for the type parameters of the current generic type.

Return Value

Type: Type
A Type representing the constructed type formed by substituting the elements of typeArguments for the type parameters of the current generic type.
Exceptions
ExceptionCondition
InvalidOperationExceptionThe current type does not represent a generic type definition. That is, IsGenericTypeDefinition returns false.
ArgumentNullExceptiontypeArguments is null.-or- Any element of typeArguments is null.
ArgumentExceptionThe number of elements in typeArguments is not the same as the number of type parameters in the current generic type definition.-or- Any element of typeArguments does not satisfy the constraints specified for the corresponding type parameter of the current generic type. -or- typeArguments contains an element that is a pointer type (IsPointer returns true), a by-ref type (IsByRef returns true), or Void.
NotSupportedExceptionThe invoked method is not supported in the base class. Derived classes must provide an implementation.
See Also