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)
Property Value
Type: System.Reflection::GenericParameterAttributesA bitwise combination of GenericParameterAttributes values that describes the covariance and special constraints of the current generic type parameter.
| Exception | Condition |
|---|---|
| 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.
Note: |
|---|
To run this example, see Building Examples That Use a Demo Method and a TextBlock Control. |
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Note: