The members of the System.Reflection.GenericParameterAttributes enumeration are divided into two groups, the variance group and the special constraints group. To test a System.Reflection.GenericParameterAttributes value for variance flags, first perform a bitwise AND operation with GenericParameterAttributes.VarianceMask. If the result is GenericParameterAttributes.None, there are no variance flags. Similarly, use GenericParameterAttributes.SpecialConstraintMask to test for constraint flags.
| Member Name | Description |
|---|---|
| Contravariant |
The generic type parameter is contravariant. A contravariant type parameter can appear as a parameter type in method signatures. |
| Covariant |
The generic type parameter is covariant. A covariant type parameter can appear as the result type of a method, the type of a read-only field, a declared base type, or an implemented interface. |
| DefaultConstructorConstraint |
A type can be substituted for the generic type parameter only if it has a parameterless constructor. |
| None |
There are no special flags. |
| NotNullableValueTypeConstraint |
A type can be substituted for the generic type parameter only if it is a value type and is not nullable. |
| ReferenceTypeConstraint |
A type can be substituted for the generic type parameter only if it is a reference type. |
| SpecialConstraintMask |
Selects the combination of all special constraint flags. This value is the result of using logical OR to combine the following flags: GenericParameterAttributes.DefaultConstructorConstraint, GenericParameterAttributes.ReferenceTypeConstraint, and GenericParameterAttributes.NotNullableValueTypeConstraint. |
| VarianceMask |
Selects the combination of all variance flags. This value is the result of using logical OR to combine the following flags: GenericParameterAttributes.Contravariant and GenericParameterAttributes.Covariant. |