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
method
IMethodDefOrRefThe method to instantiate.
signature
GenericInstanceMethodSignatureThe instantiation signature.
MethodSpecification(MetadataToken)
Creates a new empty method specification.
protected MethodSpecification(MetadataToken token)
Parameters
token
MetadataTokenThe token of the specification.
Properties
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
Method
Gets or sets the method that was instantiated.
public IMethodDefOrRef? Method { get; set; }
Property Value
Module
Gets the module that defines the member definition or reference.
public ModuleDefinition? Module { 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.
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
importer
ReferenceImporterThe 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
module
ModuleDefinitionThe module that is supposed to import the member.
Returns
- bool
true
if the descriptor of the member is fully imported by the module,false
otherwise.
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()
Resolves the reference to a method definition.
public MethodDefinition? Resolve()
Returns
- MethodDefinition
The resolved method definition, or
null
if the method could not be resolved.
Remarks
This method can only be invoked if the reference was added to a module.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.