Table of Contents

Class FileReference

Namespace
AsmResolver.DotNet
Assembly
AsmResolver.DotNet.dll

Represents a reference to an external file that a .NET module depends on.

public class FileReference : MetadataMember, IImplementation, IFullNameProvider, INameProvider, IModuleProvider, IHasCustomAttribute, IImportable, IManagedEntryPoint, IMetadataMember, IOwnedCollectionElement<ModuleDefinition>
Inheritance
FileReference
Implements
Derived
Inherited Members
Extension Methods

Constructors

FileReference(MetadataToken)

Initializes the file reference with a metadata token.

protected FileReference(MetadataToken token)

Parameters

token MetadataToken

The metadata token.

FileReference(Utf8String?, FileAttributes)

Creates a new reference to an external file.

public FileReference(Utf8String? name, FileAttributes attributes)

Parameters

name Utf8String

The name of the file.

attributes FileAttributes

The attributes associated to the reference.

Properties

Attributes

Gets or sets the attributes associated to the file reference.

public FileAttributes Attributes { get; set; }

Property Value

FileAttributes

ContainsMetadata

Gets or sets a value indicating the referenced file contains .NET metadata.

public bool ContainsMetadata { get; set; }

Property Value

bool

ContainsNoMetadata

Gets or sets a value indicating the referenced file does not contain .NET metadat.

public bool ContainsNoMetadata { get; set; }

Property Value

bool

CustomAttributes

Gets a collection of custom attributes assigned to this member.

public IList<CustomAttribute> CustomAttributes { get; }

Property Value

IList<CustomAttribute>

FullName

Gets the full name of the object.

public string FullName { get; }

Property Value

string

HashValue

Gets or sets the checksum of the referenced file.

public byte[]? HashValue { get; set; }

Property Value

byte[]

Module

Gets the module that defines the member definition or reference.

public ModuleDefinition? Module { get; }

Property Value

ModuleDefinition

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 file.

public Utf8String? Name { get; set; }

Property Value

Utf8String

Remarks

This property corresponds to the Name column in the file 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.

GetHashValue()

Obtains the hash of the referenced file.

protected virtual byte[]? GetHashValue()

Returns

byte[]

The hash.

Remarks

This method is called upon initializing the HashValue property.

GetName()

Obtains the name of the referenced file.

protected virtual Utf8String? GetName()

Returns

Utf8String

The name.

Remarks

This method is called upon initializing the Name property.

ImportWith(ReferenceImporter)

Imports the file using the provided reference importer object.

public FileReference ImportWith(ReferenceImporter importer)

Parameters

importer ReferenceImporter

The reference importer to use.

Returns

FileReference

The imported file reference.

IsImportedInModule(ModuleDefinition)

Determines whether the descriptor of the member is fully imported in the provided module.

public bool IsImportedInModule(ModuleDefinition module)

Parameters

module ModuleDefinition

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