Class GenericParameterConstraint
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents an object that constrains a generic parameter to only be instantiated with a specific type.
public class GenericParameterConstraint : MetadataMember, IHasCustomAttribute, IMetadataMember, IModuleProvider, IOwnedCollectionElement<GenericParameter>
- Inheritance
-
GenericParameterConstraint
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GenericParameterConstraint(ITypeDefOrRef?)
Creates a new constraint for a generic parameter.
public GenericParameterConstraint(ITypeDefOrRef? constraint)
Parameters
constraint
ITypeDefOrRefThe type to constrain the generic parameter to.
GenericParameterConstraint(MetadataToken)
Initializes the generic parameter constraint with a metadata token.
protected GenericParameterConstraint(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token.
Properties
Constraint
Gets or sets the type that the generic parameter was constrained to.
public ITypeDefOrRef? Constraint { get; set; }
Property Value
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
Property Value
DeclaringModule
public ModuleDefinition? DeclaringModule { get; }
Property Value
Owner
Gets the generic parameter that was constrained.
public GenericParameter? Owner { get; }
Property Value
Methods
GetConstraint()
Obtains the type that the generic parameter was constrained to.
protected virtual ITypeDefOrRef? GetConstraint()
Returns
- ITypeDefOrRef
The type.
Remarks
This method is called upon initialization of the Constraint property.
GetCustomAttributes()
Obtains the list of custom attributes assigned to the member.
protected virtual IList<CustomAttribute> GetCustomAttributes()
Returns
- IList<CustomAttribute>
The attributes
Remarks
This method is called upon initialization of the CustomAttributes property.
GetOwner()
Obtains the generic parameter that was constrained.
protected virtual GenericParameter? GetOwner()
Returns
- GenericParameter
The generic parameter
Remarks
This method is called upon initialization of the Owner property.