Gets a value indicating whether the current Type object has type parameters that have not been replaced by specific types.
Assembly: mscorlib (in mscorlib.dll)
abstract ContainsGenericParameters : bool with get override ContainsGenericParameters : bool with get
In order to create an instance of a type, there must be no generic type definitions or open constructed types in the type arguments of the type itself, in any enclosing generic types, or in any elements of the type. Another way of saying this is that when examined recursively, the type must contain no generic type parameters.
Since types can be arbitrarily complex, making this determination is difficult. For convenience and to reduce the chance of error, the property provides a standard way to distinguish between closed constructed types, which can be instantiated, and open constructed types, which cannot. If the property returns true, the type cannot be instantiated.
The property searches recursively for type parameters. For example, it returns true for an array whose elements are type A<T> (A(Of T) in Visual Basic), even though the array is not itself generic. Contrast this with the behavior of the IsGenericType property, which returns false for arrays.
For a set of example classes and a table showing the values of the property, see IsGenericType.
The following example defines a generic class with two type parameters and then defines a second generic class that derives from the first class. The derived class's base class has two type arguments: the first is Int32 and the second is a type parameter of the derived type. The example displays information about these generic classes, including the positions reported by the GenericParameterPosition property.
.NET FrameworkSupported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0
.NET Framework Client ProfileSupported in: 4, 3.5 SP1
XNA FrameworkSupported in: 3.0, 2.0, 1.0
Portable Class LibrarySupported in: Portable Class Library
Supported in: Windows Phone 8.1
Supported in: Windows Phone Silverlight 8.1
Supported in: Windows Phone Silverlight 8