Class MethodSpecification
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents a reference to a generic method that is instantiated with type arguments.
public class MethodSpecification : MetadataMember, IMethodDescriptor, IMemberDescriptor, IFullNameProvider, INameProvider, IModuleProvider, IImportable, IHasCustomAttribute, IMetadataMember
- Inheritance
-
MethodSpecification
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
MethodSpecification(IMethodDefOrRef?, GenericInstanceMethodSignature?)
Creates a new reference to a generic instantiation of a method.
public MethodSpecification(IMethodDefOrRef? method, GenericInstanceMethodSignature? signature)
Parameters
methodIMethodDefOrRefThe method to instantiate.
signatureGenericInstanceMethodSignatureThe instantiation signature.
MethodSpecification(MetadataToken)
Creates a new empty method specification.
protected MethodSpecification(MetadataToken token)
Parameters
tokenMetadataTokenThe token of the specification.
Fields
CustomAttributesInternal
The internal custom attribute list.
protected IList<CustomAttribute>? CustomAttributesInternal
Field Value
Remarks
This value may not be initialized. Use CustomAttributes instead.
Properties
ContextModule
Gets the module that defines the member definition or reference.
public ModuleDefinition? ContextModule { get; }
Property Value
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.
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
Property Value
DeclaringType
Gets the declaring type of the method.
public ITypeDefOrRef? DeclaringType { get; }
Property Value
FullName
Gets the full name of the object.
public string FullName { get; }
Property Value
HasCustomAttributes
Gets a value indicating whether the member is assigned custom attributes.
public virtual bool HasCustomAttributes { get; }
Property Value
Method
Gets or sets the method that was instantiated.
public IMethodDefOrRef? Method { get; set; }
Property Value
Name
Gets or sets the name of the method specification.
public Utf8String Name { get; }
Property Value
Signature
Gets or sets the generic instantiation of the method.
public GenericInstanceMethodSignature? Signature { get; set; }
Property Value
Methods
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.
GetMethod()
Obtains the instantiated method.
protected virtual IMethodDefOrRef? GetMethod()
Returns
- IMethodDefOrRef
The method.
Remarks
This method is called upon initialization of the Method property.
GetSignature()
Obtains the method instantiation signature.
protected virtual GenericInstanceMethodSignature? GetSignature()
Returns
- GenericInstanceMethodSignature
The signature.
Remarks
This method is called upon initialization of the Signature property.
ImportWith(ReferenceImporter)
Imports the method specification using the provided reference importer.
public MethodSpecification ImportWith(ReferenceImporter importer)
Parameters
importerReferenceImporterThe reference importer to use.
Returns
- MethodSpecification
The imported method specification.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public bool IsImportedInModule(ModuleDefinition module)
Parameters
moduleModuleDefinitionThe module that is supposed to import the member.
Returns
- bool
trueif the descriptor of the member is fully imported by the module,falseotherwise.
Remarks
This method verifies all references in the descriptor of the member only. It does not verify any additional data or contents (such as a method body) associated to the member.
Resolve(RuntimeContext?, out MethodDefinition?)
Attempts to resolve the method reference its definition, assuming the provided module as resolution context.
public ResolutionStatus Resolve(RuntimeContext? context, out MethodDefinition? definition)
Parameters
contextRuntimeContextThe context to assume when resolving the method.
definitionMethodDefinitionThe resolved method definition, or
nullif the method could not be resolved.
Returns
- ResolutionStatus
A value describing the success or failure status of the method resolution.
ToString()
public override string ToString()