Mono Class Library: System.Type Overview | Members

System.Type.GetGenericArguments Method

Returns an array of Type objects that represent the type arguments of a generic type or the type parameters of a generic type definition.

public virtual Type[] GetGenericArguments ()

Returns

An array of Type objects that represent the type arguments of a generic type or the type parameters of a generic type definition. Returns an empty array if the current type is not a generic type. The array elements are returned in the order in which they appear in the list of type arguments for the generic type.

Remarks

If the current type is a closed constructed type, the array returned by the System.Type.GetGenericArguments method contains the type arguments that are bound to the type parameters. If the current type is a generic type definition, the array contains the type parameters. If the current type is an open constructed type in which some of the type parameters are bound to specific types, the array contains both type arguments and type parameters.

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.GenericParameterPosition.

Requirements

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