Class ModuleReference
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Represents a reference to an external module. This module can be managed or unmanaged.
public class ModuleReference : MetadataMember, IResolutionScope, IImportable, IMemberRefParent, INameProvider, IModuleProvider, IHasCustomAttribute, IMetadataMember, IOwnedCollectionElement<ModuleDefinition>
- Inheritance
-
ModuleReference
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ModuleReference(MetadataToken)
Initializes the module reference with a metadata token.
protected ModuleReference(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token.
ModuleReference(Utf8String?)
Creates a new reference to an external module.
public ModuleReference(Utf8String? name)
Parameters
name
Utf8StringThe file name of the module.
Properties
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
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 module.
public Utf8String? Name { get; set; }
Property Value
Remarks
This property corresponds to the Name column in the module definition table.
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.
GetName()
Obtains the name of the module.
protected virtual Utf8String? GetName()
Returns
- Utf8String
The name.
Remarks
This method is called upon initialization of the Name property.
ImportWith(ReferenceImporter)
Imports the module reference using the provided reference importer object.
public ModuleReference ImportWith(ReferenceImporter importer)
Parameters
importer
ReferenceImporterThe reference importer to use.
Returns
- ModuleReference
The imported module.
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.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.