Class ReferenceImporter
- Namespace
- AsmResolver.DotNet
- Assembly
- AsmResolver.DotNet.dll
Provides a mechanism for creating references to members defined in external .NET modules.
public class ReferenceImporter : ITypeSignatureVisitor<TypeSignature>
- Inheritance
-
ReferenceImporter
- Implements
- Derived
- Inherited Members
Constructors
ReferenceImporter(ModuleDefinition)
Creates a new reference importer.
public ReferenceImporter(ModuleDefinition module)
Parameters
module
ModuleDefinitionThe module to import references to.
Properties
TargetModule
Gets the module to imports references to.
public ModuleDefinition TargetModule { get; }
Property Value
Methods
ImportAssembly(AssemblyDescriptor)
Imports a reference to an assembly.
protected virtual AssemblyReference ImportAssembly(AssemblyDescriptor assembly)
Parameters
assembly
AssemblyDescriptorThe assembly to import.
Returns
- AssemblyReference
The imported assembly.
ImportField(IFieldDescriptor)
Imports a reference to a field into the module.
public virtual IFieldDescriptor ImportField(IFieldDescriptor field)
Parameters
field
IFieldDescriptorThe field to import.
Returns
- IFieldDescriptor
The imported field.
Exceptions
- ArgumentException
Occurs when a field is not added to a type.
ImportField(FieldInfo)
Imports a reference to a field into the module.
public MemberReference ImportField(FieldInfo field)
Parameters
field
FieldInfoThe field to import.
Returns
- MemberReference
The imported field.
Exceptions
- ArgumentException
Occurs when a field is not added to a type.
ImportFieldSignature(FieldSignature)
Imports a field signature into the module.
public FieldSignature ImportFieldSignature(FieldSignature signature)
Parameters
signature
FieldSignatureThe signature to import.
Returns
- FieldSignature
The imported signature.
ImportFile(FileReference)
Imports a file reference.
protected virtual FileReference ImportFile(FileReference file)
Parameters
file
FileReferenceThe file to import.
Returns
- FileReference
The imported file.
ImportGenericInstanceMethodSignature(GenericInstanceMethodSignature)
Imports the provided generic instance method signature into the module.
public virtual GenericInstanceMethodSignature ImportGenericInstanceMethodSignature(GenericInstanceMethodSignature signature)
Parameters
signature
GenericInstanceMethodSignatureThe method signature to import.
Returns
- GenericInstanceMethodSignature
The imported signature.
ImportImplementation(IImplementation?)
Imports an implementation reference.
public IImplementation ImportImplementation(IImplementation? implementation)
Parameters
implementation
IImplementationThe implementation reference to import.
Returns
- IImplementation
The imported implementation reference.
ImportLocalVariablesSignature(LocalVariablesSignature)
Imports the provided local variables signature into the module.
public virtual LocalVariablesSignature ImportLocalVariablesSignature(LocalVariablesSignature signature)
Parameters
signature
LocalVariablesSignatureThe method signature to import.
Returns
- LocalVariablesSignature
The imported signature.
ImportMethod(IMethodDefOrRef)
Imports a reference to a method into the module.
public virtual IMethodDefOrRef ImportMethod(IMethodDefOrRef method)
Parameters
method
IMethodDefOrRefThe method to import.
Returns
- IMethodDefOrRef
The imported method.
Exceptions
- ArgumentException
Occurs when a method is not added to a type.
ImportMethod(IMethodDescriptor)
Imports a reference to- or an instantiation of a method into the module.
public virtual IMethodDescriptor ImportMethod(IMethodDescriptor method)
Parameters
method
IMethodDescriptorThe method to import.
Returns
- IMethodDescriptor
The imported method.
Exceptions
- ArgumentException
Occurs when a method is not added to a type.
ImportMethod(MethodSpecification)
Imports a reference to a generic method instantiation into the module.
public virtual MethodSpecification ImportMethod(MethodSpecification method)
Parameters
method
MethodSpecificationThe method to import.
Returns
- MethodSpecification
The imported method.
ImportMethod(MethodBase)
Imports a reference to a method into the module.
public virtual IMethodDescriptor ImportMethod(MethodBase method)
Parameters
method
MethodBaseThe method to import.
Returns
- IMethodDescriptor
The imported method.
ImportMethodOrNull(IMethodDefOrRef?)
Imports a reference to- or an instantiation of a method into the module.
public IMethodDefOrRef? ImportMethodOrNull(IMethodDefOrRef? method)
Parameters
method
IMethodDefOrRefThe method to import.
Returns
- IMethodDefOrRef
The imported method, or
null
if no method was provided..
Exceptions
- ArgumentException
Occurs when a method is not added to a type.
ImportMethodOrNull(IMethodDescriptor?)
Imports a reference to- or an instantiation of a method into the module.
public IMethodDescriptor? ImportMethodOrNull(IMethodDescriptor? method)
Parameters
method
IMethodDescriptorThe method to import.
Returns
- IMethodDescriptor
The imported method, or
null
if no method was provided..
Exceptions
- ArgumentException
Occurs when a method is not added to a type.
ImportMethodSignature(MethodSignature)
Imports the provided method signature into the module.
public virtual MethodSignature ImportMethodSignature(MethodSignature signature)
Parameters
signature
MethodSignatureThe method signature to import.
Returns
- MethodSignature
The imported signature.
ImportModule(ModuleReference)
Imports a reference to a module.
public virtual ModuleReference ImportModule(ModuleReference module)
Parameters
module
ModuleReferenceThe module to import.
Returns
- ModuleReference
The imported module.
ImportPropertySignature(PropertySignature)
Imports a signature of a property into the module.
public PropertySignature ImportPropertySignature(PropertySignature signature)
Parameters
signature
PropertySignatureThe signature to import.
Returns
- PropertySignature
The imported signature.
ImportScope(IResolutionScope)
Imports a resolution scope.
public IResolutionScope ImportScope(IResolutionScope scope)
Parameters
scope
IResolutionScopeThe resolution scope to import.
Returns
- IResolutionScope
The imported resolution scope.
ImportType(ExportedType)
Imports a forwarded type.
public virtual ExportedType ImportType(ExportedType type)
Parameters
type
ExportedTypeThe type to import.
Returns
- ExportedType
The imported type.
ImportType(ITypeDefOrRef)
Imports a reference to a type into the module.
public ITypeDefOrRef ImportType(ITypeDefOrRef type)
Parameters
type
ITypeDefOrRefThe type to import.
Returns
- ITypeDefOrRef
The imported type.
ImportType(TypeDefinition)
Imports a reference to a type definition into the module.
protected virtual ITypeDefOrRef ImportType(TypeDefinition type)
Parameters
type
TypeDefinitionThe type to import.
Returns
- ITypeDefOrRef
The imported type.
ImportType(TypeReference)
Imports a reference to a type into the module.
protected virtual ITypeDefOrRef ImportType(TypeReference type)
Parameters
type
TypeReferenceThe type to import.
Returns
- ITypeDefOrRef
The imported type.
ImportType(TypeSpecification)
Imports a reference to a type specification into the module.
protected virtual ITypeDefOrRef ImportType(TypeSpecification type)
Parameters
type
TypeSpecificationThe type to import.
Returns
- ITypeDefOrRef
The imported type.
ImportType(Type)
Imports a Type as a type reference or specification.
public virtual ITypeDefOrRef ImportType(Type type)
Parameters
type
TypeThe type to import.
Returns
- ITypeDefOrRef
The imported type.
ImportTypeOrNull(ITypeDefOrRef?)
Imports a reference to a type into the module.
public ITypeDefOrRef? ImportTypeOrNull(ITypeDefOrRef? type)
Parameters
type
ITypeDefOrRefThe type to import.
Returns
- ITypeDefOrRef
The imported type, or
null
if the provided type wasnull
.
ImportTypeSignature(TypeSignature)
Imports the given type signature into the target module.
public virtual TypeSignature ImportTypeSignature(TypeSignature type)
Parameters
type
TypeSignatureThe type signature to import.
Returns
- TypeSignature
The imported type signature.
ImportTypeSignature(Type)
Imports a Type as a type signature.
public virtual TypeSignature ImportTypeSignature(Type type)
Parameters
type
TypeThe type to import.
Returns
- TypeSignature
The imported type.
ImportTypeSignatureOrNull(TypeSignature?)
Imports the given type signature into the target module.
public TypeSignature? ImportTypeSignatureOrNull(TypeSignature? type)
Parameters
type
TypeSignatureThe type signature to import.
Returns
- TypeSignature
The imported type signature, or
nulL
if the provided type signature wasnull
.