Substitutes the elements of an array of types for the type parameters of the current generic type definition, and returns the resulting constructed type.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.Type
An array of types to be substituted for the type parameters of the current generic type definition.
The current type does not represent the definition of a generic type. That is, IsGenericTypeDefinition returns false.
typeArguments is null.
Any element of typeArguments is null.
Any element of typeArguments does not satisfy the constraints specified for the corresponding type parameter of the current generic type.
Use this method when your emitted code requires a type constructed from the current generic type definition. It is not necessary to call the CreateType method before calling the method on a TypeBuilder that represents a generic type definition. If the current TypeBuilder does not represent the definition of a generic type, an InvalidOperationException is thrown.
The object returned by this method functions as a placeholder for a constructed generic type in your emitted code. It is an instance of a class derived from Type that has limited capabilities. In particular:
To get methods, fields, and constructors for these constructed generic types, use the GetMethod(Type, MethodInfo), GetField(Type, FieldInfo), and GetConstructor(Type, ConstructorInfo) method overloads.
Two instances that represent the same constructed type do not compare as equal. For example, in the following code t1.Equals(t2) returns false:
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2