Export (0) Print
Expand All

Type.GenericParameterAttributes Property

Gets a combination of GenericParameterAttributes flags that describe the covariance and special constraints of the current generic type parameter.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

abstract GenericParameterAttributes : GenericParameterAttributes
override GenericParameterAttributes : GenericParameterAttributes

Property Value

Type: System.Reflection.GenericParameterAttributes
A bitwise combination of GenericParameterAttributes values that describes the covariance and special constraints of the current generic type parameter.

ExceptionCondition
InvalidOperationException

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

NotSupportedException

The invoked method is not supported in the base class.

The value of this property contains flags that describe whether the current generic type parameter is covariant, and flags that describe any special constraints. Use the GenericParameterAttributes.VarianceMask value to select the covariance flags, and use the GenericParameterAttributes.SpecialConstraintMask value to select the constraint flags.

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

The following code example defines a generic type Test with two type parameters that have different constraints. When the program executes, the constraints are examined using the GenericParameterAttributes property and the GetGenericParameterConstraints method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft