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
IImplementationThe file containing the type.
ns
stringThe namespace of the type.
name
stringThe name of the type.
ExportedType(MetadataToken)
Initializes an exported type with a metadata token.
protected ExportedType(MetadataToken token)
Parameters
token
MetadataTokenThe metadata token.
Properties
Attributes
Gets or sets the attributes associated to the type.
public TypeAttributes Attributes { get; set; }
Property Value
CustomAttributes
Gets a collection of custom attributes assigned to this member.
public IList<CustomAttribute> CustomAttributes { get; }
Property Value
DeclaringType
When this exported type is nested, gets the enclosing type.
public ExportedType? DeclaringType { get; }
Property Value
FullName
Gets the full name of the object.
public string FullName { get; }
Property Value
Implementation
Gets or sets the new location this type is exported to.
public IImplementation? Implementation { get; set; }
Property Value
IsValueType
Gets a value indicating whether instances of this type are passed on by value or by reference.
public bool IsValueType { get; }
Property Value
Module
Gets the module that defines the member definition or reference.
public ModuleDefinition? Module { get; }
Property Value
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
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
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
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
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
ReferenceImporterThe 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
ModuleDefinitionThe 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.