Table of Contents

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 ModuleDefinition

The module to import references to.

Properties

TargetModule

Gets the module to imports references to.

public ModuleDefinition TargetModule { get; }

Property Value

ModuleDefinition

Methods

ImportAssembly(AssemblyDescriptor)

Imports a reference to an assembly.

protected virtual AssemblyReference ImportAssembly(AssemblyDescriptor assembly)

Parameters

assembly AssemblyDescriptor

The 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 IFieldDescriptor

The 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 FieldInfo

The 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 FieldSignature

The signature to import.

Returns

FieldSignature

The imported signature.

ImportFile(FileReference)

Imports a file reference.

protected virtual FileReference ImportFile(FileReference file)

Parameters

file FileReference

The 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 GenericInstanceMethodSignature

The method signature to import.

Returns

GenericInstanceMethodSignature

The imported signature.

ImportImplementation(IImplementation?)

Imports an implementation reference.

public IImplementation ImportImplementation(IImplementation? implementation)

Parameters

implementation IImplementation

The 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 LocalVariablesSignature

The 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 IMethodDefOrRef

The 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 IMethodDescriptor

The 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 MethodSpecification

The 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 MethodBase

The 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 IMethodDefOrRef

The 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 IMethodDescriptor

The 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 MethodSignature

The 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 ModuleReference

The 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 PropertySignature

The signature to import.

Returns

PropertySignature

The imported signature.

ImportScope(IResolutionScope)

Imports a resolution scope.

public IResolutionScope ImportScope(IResolutionScope scope)

Parameters

scope IResolutionScope

The resolution scope to import.

Returns

IResolutionScope

The imported resolution scope.

ImportType(ExportedType)

Imports a forwarded type.

public virtual ExportedType ImportType(ExportedType type)

Parameters

type ExportedType

The 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 ITypeDefOrRef

The 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 TypeDefinition

The 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 TypeReference

The 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 TypeSpecification

The 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 Type

The 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 ITypeDefOrRef

The type to import.

Returns

ITypeDefOrRef

The imported type, or null if the provided type was null.

ImportTypeSignature(TypeSignature)

Imports the given type signature into the target module.

public virtual TypeSignature ImportTypeSignature(TypeSignature type)

Parameters

type TypeSignature

The 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 Type

The 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 TypeSignature

The type signature to import.

Returns

TypeSignature

The imported type signature, or nulL if the provided type signature was null.