Mono Class Library: System.Type Overview | MembersSystem.Type.IsGenericType Property |
Gets a value that indicates whether the current type has type arguments, and is therefore a generic type. [Edit]
|
true if the current type has type arguments; otherwise false. [Edit]
Use this property to determine whether a Type object represents a generic type. Use the Type.ContainsGenericParameters property to determine whether a Type object represents an open constructed type or a closed constructed type.
Note: The Type.HasGenericArguments property returns false if the immediate type is not generic.The following table summarizes the invariant conditions for common terms used in generic reflection.
Term Invariant generic type definition The Type.IsGenericTypeDefinition property is true.
Defines a generic type. A constructed type is created by calling the Type.MakeGenericType(System.Type[]) method on a Type object that represents a generic type definition, and specifying an array of type arguments.
Type.MakeGenericType(System.Type[]) can be called only on generic type definitions.
Any generic type definition is a generic type, but the converse is not true.
generic type The Type.IsGenericType property is true.
Can be a generic type definition, an open constructed type, or a closed constructed type.
Note that an array type whose element type is generic is not itself a generic type. The same is true of a Type object representing a pointer to a generic type.
open constructed type The Type.ContainsGenericParameters property is true.
It is not possible to create an instance of an open constructed type.
Note that not all open constructed types are generic, such as an array type whose element type is a generic type definition.
closed constructed type The Type.ContainsGenericParameters property is false.
When examined recursively, the type has no unassigned generic parameters. The containing type or method has no generic type parameters, and, recursively, no type arguments have unassigned generic type parameters.
generic type parameter The Type.IsGenericParameter property is true.
In a generic type definition, a placeholder for a type that will be assigned later.
generic type argument Can be any type, including a generic type parameter.
Type arguments are specified as an array of Type objects passed to the Type.MakeGenericType(System.Type[]) method when creating a constructed generic type. If instances of the resulting type are to be created, the Type.ContainsGenericParameters property must be false for all the type arguments.
Operation
This property is read-only.
[Edit]
For an example of using this method, see the example for Type.MakeGenericType.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0