System.Type.IsGenericTypeDefinition Property

Gets a value indicating whether the current Type represents a generic type definition, from which other generic types can be constructed.

Syntax

public virtual bool IsGenericTypeDefinition { get; }

Value

true if the current object represents the definition of a generic type, none of whose type parameters have been bound to specific types; otherwise false.

Remarks

A generic type definition is a template from which other types can be constructed. For example, from the generic type definition G<T> (expressed in C# syntax; G(Of T) in Visual Basic or generic <typename T> ref class G in C++) you can construct and instantiate the type G<int> (G(Of Integer) in Visual Basic), by calling the Type.MakeGenericType(Type[]) method with a generic argument list containing the int type. Given a Type object representing this constructed type, the Type.GetGenericTypeDefinition method gets the generic type definition back again.

Use the Type.IsGenericTypeDefinition property to determine whether you can create new types from the current type. If the Type.IsGenericTypeDefinition property returns true, you can call the Type.MakeGenericType(Type[]) method to create new generic types.

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

Example

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

Requirements

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