Mono Class Library: System.Type Overview | Members

System.Type.GetGenericParameterConstraints Method

Returns an array of Type objects that represent the type constraints on the current generic type parameter.

public virtual Type[] GetGenericParameterConstraints ()

Returns

An array of Type objects that represent the type constraints on the current generic type parameter.

Exceptions

TypeReason
InvalidOperationExceptionThe current Type object is not a generic type parameter. That is, the Type.IsGenericParameter property returns false.

Remarks

Each constraint on a generic type parameter is expressed as a Type object. The first element of the array is the class constraint, if any. If a type parameter has no class constraint and no interface constraints, an empty array of Type is returned for that type parameter. Use Reflection.GenericParameterAttributes to get the special constraints.

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

Requirements

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