TypeBuilder.GetGenericTypeDefinition Method

Note: This method is new in the .NET Framework version 2.0.

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 ()
public Type GetGenericTypeDefinition ()
public override function GetGenericTypeDefinition () : Type

Return Value

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

Exception typeCondition

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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: