System.Reflection.Emit.GenericTypeParameterBuilder.SetGenericParameterAttributes Method

Sets the variance characteristics and special constraints of the generic parameter, such as the parameterless constructor constraint.

Syntax

public void SetGenericParameterAttributes (System.Reflection.GenericParameterAttributes genericParameterAttributes)

Parameters

genericParameterAttributes
A bitwise combination of System.Reflection.GenericParameterAttributes values that represent the variance characteristics and special constraints of the generic type parameter.

Remarks

Special constraints can specify that any type assigned to the generic type parameter must have a default constructor, must be a reference type, or must be a value type.

Special constraints cannot be retrieved using methods of the System.Reflection.Emit.GenericTypeParameterBuilder class. Once you have created the generic type that contains the type parameter, you can use its Type object to reflect the type parameters and their constraints. To get the type parameters of a completed generic type, use the Type.GetGenericArguments method. To get the special constraints for each type parameter, use the Type.GenericParameterAttributes property.

The System.Reflection.GenericParameterAttributes enumeration values that refer to the variance characteristics of a type parameter are relevant only in languages that support covariance and contravariance, such as Microsoft intermediate language (MSIL). Visual Basic and C# currently do not support covariance and contravariance.

Requirements

Namespace: System.Reflection.Emit
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0