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: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax 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:
TypeA
Type representing the constructed type formed by substituting the elements of
typeArguments for the type parameters of the current generic type.
Exceptions Exception | Condition |
---|
InvalidOperationException | The current type does not represent a generic type definition. That is, IsGenericTypeDefinition returns false. |
ArgumentNullException | typeArguments is null.-or- Any element of typeArguments is null. |
ArgumentException | The 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. |
NotSupportedException | The invoked method is not supported in the base class. Derived classes must provide an implementation. |
See Also