Mono Class Library: System.Type Overview | Members

System.Type.GetGenericTypeDefinition Method

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

public virtual Type GetGenericTypeDefinition ()

Returns

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

Exceptions

TypeReason
InvalidOperationExceptionThe current type is not a generic type. That is, Type.HasGenericArguments returns false.

Remarks

If two constructed types are created from the same generic type definition, the Type.GetGenericTypeDefinition method returns the same Type object for both types.

If you call Type.GetGenericTypeDefinition on a Type object that already represents a generic type definition, it returns the current Type.

Note: An array type whose element type is a generic type is not itself generic. Use Type.IsGenericType to determine whether a type is generic before calling Type.GetGenericTypeDefinition.

For a list of the invariant conditions for terms used in generic reflection, see the Type.IsGenericType property description.

Example

For an example of using this method, see the example for Type.MakeGenericType.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0