Class ReflectionAssemblyDescriptor
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Provides a wrapper for Assembly that maps properties declared by Assembly onto an AssemblyDescriptor instance. This can be used for importing assemblies referenced by System.Reflection.
public class ReflectionAssemblyDescriptor : AssemblyDescriptor, IHasCustomAttribute, IMetadataMember, IFullNameProvider, INameProvider, IImportable
- Inheritance
-
ReflectionAssemblyDescriptor
- Implements
- Inherited Members
- Extension Methods
Constructors
ReflectionAssemblyDescriptor(ModuleDefinition, AssemblyName)
Creates a new instance of the ReflectionAssemblyDescriptor class.
public ReflectionAssemblyDescriptor(ModuleDefinition parentModule, AssemblyName assemblyName)
Parameters
parentModule
ModuleDefinitionThe module that imports this assembly.
assemblyName
AssemblyNameThe assembly name to import.
ReflectionAssemblyDescriptor(AssemblyName)
Creates a new instance of the ReflectionAssemblyDescriptor class.
public ReflectionAssemblyDescriptor(AssemblyName assemblyName)
Parameters
assemblyName
AssemblyNameThe assembly name to import.
Properties
IsCorLib
Gets a value indicating whether the assembly descriptor references a Common Object Runtime standard library.
public override bool IsCorLib { get; }
Property Value
Methods
GetCulture()
Obtains the locale string of the assembly definition.
protected override Utf8String? GetCulture()
Returns
- Utf8String
The locale string.
Remarks
This method is called upon initializing the Culture property.
GetName()
Obtains the name of the assembly definition.
protected override Utf8String? GetName()
Returns
- Utf8String
The name.
Remarks
This method is called upon initializing the Name property.
GetPublicKeyToken()
When the application is signed with a strong name, obtains the public key token of the assembly
public override byte[]? GetPublicKeyToken()
Returns
- byte[]
The token.
ImportWith(ReferenceImporter)
Imports the assembly descriptor using the provided reference importer.
public override AssemblyReference ImportWith(ReferenceImporter importer)
Parameters
importer
ReferenceImporterThe importer object to use.
Returns
- AssemblyReference
The imported assembly reference.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public override 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 the assembly to an assembly definition.
public override AssemblyDefinition? Resolve()
Returns
- AssemblyDefinition
The assembly definition, or
null
if the resolution failed.