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, IImportable, IModuleProvider, IOwnedCollectionElement<ModuleDefinition>
Inheritance
ExportedType
Implements
Derived
Inherited Members
Extension Methods

Constructors

ExportedType(IImplementation?, Utf8String?, Utf8String?)

Creates a new exported type reference.

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

Parameters

implementation IImplementation

The file containing the type.

ns Utf8String

The namespace of the type.

name Utf8String

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.

Fields

CustomAttributesInternal

The internal custom attribute list.

protected IList<CustomAttribute>? CustomAttributesInternal

Field Value

IList<CustomAttribute>

Remarks

This value may not be initialized. Use CustomAttributes instead.

Properties

Attributes

Gets or sets the attributes associated to the type.

public TypeAttributes Attributes { get; set; }

Property Value

TypeAttributes

ContextModule

Gets the module that defines the member definition or reference.

public ModuleDefinition? ContextModule { 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.

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

HasCustomAttributes

Gets a value indicating whether the member is assigned custom attributes.

public virtual bool HasCustomAttributes { get; }

Property Value

bool

Implementation

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

public IImplementation? Implementation { get; set; }

Property Value

IImplementation

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.

IsTypeOfUtf8(Utf8String?, Utf8String?)

Determines whether a type matches a namespace and name pair.

public bool IsTypeOfUtf8(Utf8String? ns, Utf8String? name)

Parameters

ns Utf8String

The namespace.

name Utf8String

The name.

Returns

bool

true if the name and the namespace of the type matches the provided values, false otherwise.

ToString()

public override string ToString()

Returns

string

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(RuntimeContext?)

Converts the type in a type signature.

public TypeSignature ToTypeSignature(RuntimeContext? context)

Parameters

context RuntimeContext

The runtime context to assume when creating the signature.

Returns

TypeSignature

The new type signature.

Remarks

When this type is a signature, gets the underlying type signature instance. Otherwise, a new signature will be instantiated.

ToTypeSignature(bool)

Wraps the type reference in a signature, forcing the value of IsValueType to be a specific value.

public TypeSignature ToTypeSignature(bool isValueType)

Parameters

isValueType bool

Indicates whether the signature should be considered a value type or not.

Returns

TypeSignature

The new type signature.

TryGetIsValueType(RuntimeContext?)

Determines whether the type is considered a value type or reference type by the runtime.

public bool? TryGetIsValueType(RuntimeContext? context)

Parameters

context RuntimeContext

The runtime context that is assumed.

Returns

bool?

true when the type is considered a value type, false when it is a reference type, null when unknown.