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
implementationIImplementationThe file containing the type.
nsUtf8StringThe namespace of the type.
nameUtf8StringThe name of the type.
ExportedType(MetadataToken)
Initializes an exported type with a metadata token.
protected ExportedType(MetadataToken token)
Parameters
tokenMetadataTokenThe metadata token.
Fields
CustomAttributesInternal
The internal custom attribute list.
protected IList<CustomAttribute>? CustomAttributesInternal
Field Value
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
ContextModule
Gets the module that defines the member definition or reference.
public ModuleDefinition? ContextModule { 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.
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
HasCustomAttributes
Gets a value indicating whether the member is assigned custom attributes.
public virtual bool HasCustomAttributes { get; }
Property Value
Implementation
Gets or sets the new location this type is exported to.
public IImplementation? Implementation { get; set; }
Property Value
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
importerReferenceImporterThe 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
moduleModuleDefinitionThe module that is supposed to import the member.
Returns
- bool
trueif the descriptor of the member is fully imported by the module,falseotherwise.
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
nsUtf8StringThe namespace.
nameUtf8StringThe name.
Returns
- bool
trueif the name and the namespace of the type matches the provided values,falseotherwise.
ToString()
public override string ToString()
Returns
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
contextRuntimeContextThe 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
isValueTypeboolIndicates 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
contextRuntimeContextThe runtime context that is assumed.
Returns
- bool?
truewhen the type is considered a value type,falsewhen it is a reference type,nullwhen unknown.