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
moduleModuleDefinitionThe 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
assemblyAssemblyDescriptorThe 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
fieldIFieldDescriptorThe 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
fieldFieldInfoThe 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
signatureFieldSignatureThe signature to import.
Returns
- FieldSignature
The imported signature.
ImportFile(FileReference)
Imports a file reference.
protected virtual FileReference ImportFile(FileReference file)
Parameters
fileFileReferenceThe 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
signatureGenericInstanceMethodSignatureThe method signature to import.
Returns
- GenericInstanceMethodSignature
The imported signature.
ImportImplementation(IImplementation?)
Imports an implementation reference.
public IImplementation ImportImplementation(IImplementation? implementation)
Parameters
implementationIImplementationThe 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
signatureLocalVariablesSignatureThe 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
methodIMethodDefOrRefThe 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
methodIMethodDescriptorThe 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
methodMethodSpecificationThe 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
methodMethodBaseThe 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
methodIMethodDefOrRefThe method to import.
Returns
- IMethodDefOrRef
The imported method, or
nullif 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
methodIMethodDescriptorThe method to import.
Returns
- IMethodDescriptor
The imported method, or
nullif 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
signatureMethodSignatureThe method signature to import.
Returns
- MethodSignature
The imported signature.
ImportModule(ModuleReference)
Imports a reference to a module.
public virtual ModuleReference ImportModule(ModuleReference module)
Parameters
moduleModuleReferenceThe 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
signaturePropertySignatureThe signature to import.
Returns
- PropertySignature
The imported signature.
ImportScope(IResolutionScope)
Imports a resolution scope.
public IResolutionScope ImportScope(IResolutionScope scope)
Parameters
scopeIResolutionScopeThe resolution scope to import.
Returns
- IResolutionScope
The imported resolution scope.
ImportType(ExportedType)
Imports a forwarded type.
public virtual ExportedType ImportType(ExportedType type)
Parameters
typeExportedTypeThe 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
typeITypeDefOrRefThe 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
typeTypeDefinitionThe 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
typeTypeReferenceThe 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
typeTypeSpecificationThe 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
typeTypeThe 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
typeITypeDefOrRefThe type to import.
Returns
- ITypeDefOrRef
The imported type, or
nullif the provided type wasnull.
ImportTypeSignature(TypeSignature)
Imports the given type signature into the target module.
public virtual TypeSignature ImportTypeSignature(TypeSignature type)
Parameters
typeTypeSignatureThe 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
typeTypeThe 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
typeTypeSignatureThe type signature to import.
Returns
- TypeSignature
The imported type signature, or
nulLif the provided type signature wasnull.