Mono Class Library: System.Type Overview | Members

System.Type.ContainsGenericParameters Property

Gets a value that indicates whether a Type object contains unassigned generic parameters.

public virtual bool ContainsGenericParameters { get; }

Value

true if a Type object contains unassigned generic parameters; otherwise false.

Remarks

In order to create an instance of a generic type, there must be no generic type definitions or open constructed types in the type arguments. For other constructed types, such as arrays and managed pointers, the types from which they are constructed must be able to be instantiated. If the Type.ContainsGenericParameters property returns true, the type cannot be instantiated.

The Type.ContainsGenericParameters property searches recursively for type parameters. For example, it returns true for an array whose element type is A<T>, even though the array type itself is not generic. Contrast this with the behavior of the Type.IsGenericType property, which returns false for arrays.

For a set of example classes and a table showing the values of the Type.ContainsGenericParameters property, see the Type.IsGenericType property description.

Operation

This property is read-only.

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