Share via


TypeBuilder.GetGenericTypeDefinition Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Overrides Function GetGenericTypeDefinition As Type
public override Type GetGenericTypeDefinition()

Return Value

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

Exceptions

Exception Condition
InvalidOperationException

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

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.