Table of Contents

Class ExportedType

Namespace
AsmResolver.DotNet
Assembly
AsmResolver.DotNet.dll

Represents a type definition that was exported to another external .NET module.

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

Constructors

ExportedType(IImplementation?, string?, string?)

Creates a new exported type reference.

public ExportedType(IImplementation? implementation, string? ns, string? name)

Parameters

implementation IImplementation

The file containing the type.

ns string

The namespace of the type.

name string

The name of the type.

ExportedType(MetadataToken)

Initializes an exported type with a metadata token.

protected ExportedType(MetadataToken token)

Parameters

token MetadataToken

The metadata token.

Properties

Attributes

Gets or sets the attributes associated to the type.

public TypeAttributes Attributes { get; set; }

Property Value

TypeAttributes

CustomAttributes

Gets a collection of custom attributes assigned to this member.

public IList<CustomAttribute> CustomAttributes { get; }

Property Value

IList<CustomAttribute>

DeclaringType

When this exported type is nested, gets the enclosing type.

public ExportedType? DeclaringType { get; }

Property Value

ExportedType

FullName

Gets the full name of the object.

public string FullName { get; }

Property Value

string

Implementation

Gets or sets the new location this type is exported to.

public IImplementation? Implementation { get; set; }

Property Value

IImplementation

IsValueType

Gets a value indicating whether instances of this type are passed on by value or by reference.

public bool IsValueType { get; }

Property Value

bool

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

public Utf8String? Name { get; set; }

Property Value

Utf8String

Remarks

This property corresponds to the Name column in the exported type table.

Namespace

Gets or sets the namespace of the type.

public Utf8String? Namespace { get; set; }

Property Value

Utf8String

Remarks

This property corresponds to the Namespace column in the exported type table.

Scope

Gets the resolution scope that defines the type.

public IResolutionScope? Scope { get; }

Property Value

IResolutionScope

TypeDefId

Gets or sets a hint to the row identifier of the type definition in the external module.

public uint TypeDefId { get; set; }

Property Value

uint

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.

GetImplementation()

Obtains the implementation of the exported type.

protected virtual IImplementation? GetImplementation()

Returns

IImplementation

The name.

Remarks

This method is called upon initialization of the Implementation property.

GetName()

Obtains the name of the exported type.

protected virtual Utf8String? GetName()

Returns

Utf8String

The name.

Remarks

This method is called upon initialization of the Name property.

GetNamespace()

Obtains the namespace of the exported type.

protected virtual Utf8String? GetNamespace()

Returns

Utf8String

The namespace.

Remarks

This method is called upon initialization of the Namespace property.

ImportWith(ReferenceImporter)

Imports the exported type using the provided importer object.

public ExportedType ImportWith(ReferenceImporter importer)

Parameters

importer ReferenceImporter

The reference importer to use.

Returns

ExportedType

The imported type.

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.

Resolve()

Resolves the reference to a type definition.

public TypeDefinition? Resolve()

Returns

TypeDefinition

The resolved type definition, or null if the type could not be resolved.

Remarks

This method can only be invoked if the reference was added to a module.

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

ToTypeDefOrRef()

Transforms the type descriptor to an instance of a ITypeDefOrRef, which can be referenced by a metadata token.

public ITypeDefOrRef ToTypeDefOrRef()

Returns

ITypeDefOrRef

The constructed TypeDefOrRef instance.

ToTypeSignature()

Transforms the type descriptor to an instance of a TypeSignature, which can be used in blob signatures.

public TypeSignature ToTypeSignature()

Returns

TypeSignature

The constructed type signature instance.