Table of Contents

Class GenericParameter

Namespace
AsmResolver.DotNet
Assembly
AsmResolver.DotNet.dll

Represents a type parameter that a generic method or type in a .NET module defines.

public class GenericParameter : MetadataMember, INameProvider, IHasCustomAttribute, IMetadataMember, IModuleProvider, IOwnedCollectionElement<IHasGenericParameters>
Inheritance
GenericParameter
Implements
Derived
Inherited Members
Extension Methods

Constructors

GenericParameter(MetadataToken)

Initializes a new empty generic parameter.

protected GenericParameter(MetadataToken token)

Parameters

token MetadataToken

The token of the generic parameter.

GenericParameter(Utf8String?)

Creates a new generic parameter.

public GenericParameter(Utf8String? name)

Parameters

name Utf8String

The name of the parameter.

GenericParameter(Utf8String?, GenericParameterAttributes)

Creates a new generic parameter.

public GenericParameter(Utf8String? name, GenericParameterAttributes attributes)

Parameters

name Utf8String

The name of the parameter.

attributes GenericParameterAttributes

Additional attributes to assign to the parameter.

Properties

Attributes

Gets or sets additional attributes assigned to this generic parameter.

public GenericParameterAttributes Attributes { get; set; }

Property Value

GenericParameterAttributes

Constraints

Gets a collection of constraints put on the generic parameter.

public IList<GenericParameterConstraint> Constraints { get; }

Property Value

IList<GenericParameterConstraint>

CustomAttributes

Gets a collection of custom attributes assigned to this member.

public IList<CustomAttribute> CustomAttributes { get; }

Property Value

IList<CustomAttribute>

HasDefaultConstructorConstraint

Gets or sets a value indicating whether this generic parameter has a DefaultConstructorConstraint.

public bool HasDefaultConstructorConstraint { get; set; }

Property Value

bool

HasNotNullableValueTypeConstraint

Gets or sets a value indicating whether this generic parameter has a NotNullableValueTypeConstraint.

public bool HasNotNullableValueTypeConstraint { get; set; }

Property Value

bool

HasReferenceTypeConstraint

Gets or sets a value indicating whether this generic parameter has a ReferenceTypeConstraint.

public bool HasReferenceTypeConstraint { get; set; }

Property Value

bool

IsContravariant

Gets a value indicating whether this generic parameter is Contravariant.

public bool IsContravariant { get; }

Property Value

bool

IsCovariant

Gets a value indicating whether this generic parameter is Covariant.

public bool IsCovariant { get; }

Property Value

bool

IsNonVariant

Gets or sets a value indicating whether this generic parameter is NonVariant.

public bool IsNonVariant { get; }

Property Value

bool

Module

Gets the module that defines the member definition or reference.

public ModuleDefinition? Module { get; }

Property Value

ModuleDefinition

Remarks

For member references, this does not obtain the module definition that the member is defined in. Rather, it obtains the module definition that references this reference.

Name

Gets or sets the name of the generic parameter.

public Utf8String? Name { get; set; }

Property Value

Utf8String

Remarks

This property corresponds to the Name column in the generic parameter table.

Number

Gets the index of this parameter within the list of generic parameters that the owner defines.

public ushort Number { get; }

Property Value

ushort

Owner

Gets the member that defines this generic parameter.

public IHasGenericParameters? Owner { get; }

Property Value

IHasGenericParameters

Variance

Gets or sets a value indicating the variance of this generic parameter.

public GenericParameterAttributes Variance { get; set; }

Property Value

GenericParameterAttributes

Methods

GetConstraints()

Obtains a collection of constraints put on the generic parameter.

protected virtual IList<GenericParameterConstraint> GetConstraints()

Returns

IList<GenericParameterConstraint>

The constraints

Remarks

This method is called upon initialization of the Constraints 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.

GetName()

Obtains the name of the generic parameter.

protected virtual Utf8String? GetName()

Returns

Utf8String

The name.

Remarks

This method is called upon initialization of the Name property.

GetOwner()

Obtains the owner of the generic parameter.

protected virtual IHasGenericParameters? GetOwner()

Returns

IHasGenericParameters

The owner

Remarks

This method is called upon initialization of the Owner property.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.