TypeBuilder.GetGenericTypeDefinition Method

Returns a Type object that represents a generic type definition from which the current type can be obtained.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

public override Type GetGenericTypeDefinition()

Return Value

Type: System.Type
A Type object representing a generic type definition from which the current type can be obtained.

ExceptionCondition
InvalidOperationException

The current type is not generic. That is, IsGenericType returns false.

If you call the GetGenericTypeDefinition method on a TypeBuilder object for which the IsGenericType property returns true, the GetGenericTypeDefinition property returns the current instance. A TypeBuilder that represents a generic type is always a generic type definition.

If you used the MakeGenericType method to construct a generic type from a TypeBuilder object that represents a generic type definition, using the Type.GetGenericTypeDefinition method on the constructed type gets back the TypeBuilder object that represents the generic type definition.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft