Class GenericInstanceTypeSignature
- Namespace
- AsmResolver.DotNet.Signatures
- Assembly
- AsmResolver.DotNet.dll
Represents an instantiation of a generic type.
public class GenericInstanceTypeSignature : TypeSignature, ITypeDescriptor, IMemberDescriptor, IFullNameProvider, INameProvider, IModuleProvider, IImportable, IGenericArgumentsProvider
- Inheritance
-
GenericInstanceTypeSignature
- Implements
- Inherited Members
- Extension Methods
Constructors
GenericInstanceTypeSignature(ITypeDefOrRef, bool)
Creates a new instantiation of a generic type.
public GenericInstanceTypeSignature(ITypeDefOrRef genericType, bool isValueType)
Parameters
genericTypeITypeDefOrRefThe type to instantiate.
isValueTypeboolIndicates the type is a value type or not.
GenericInstanceTypeSignature(ITypeDefOrRef, bool, params TypeSignature[])
Creates a new instantiation of a generic type.
public GenericInstanceTypeSignature(ITypeDefOrRef genericType, bool isValueType, params TypeSignature[] typeArguments)
Parameters
genericTypeITypeDefOrRefThe type to instantiate.
isValueTypeboolIndicates the type is a value type or not.
typeArgumentsTypeSignature[]The arguments to use for instantiating the generic type.
Properties
ContextModule
Gets the module that defines the member definition or reference.
public override 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.
ElementType
Gets the element type of the
public override ElementType ElementType { get; }
Property Value
GenericType
Gets the underlying generic type definition or reference.
public ITypeDefOrRef GenericType { get; }
Property Value
Remarks
To update the generic type, use SetUnderlyingType(ITypeDefOrRef, RuntimeContext?) or SetUnderlyingType(ITypeDefOrRef, bool).
IsValueType
Gets a value indicating whether the type signature is encoded as a value type or a reference type.
public override bool IsValueType { get; }
Property Value
Name
Gets the name of the object.
public override string Name { get; }
Property Value
Namespace
Gets the namespace the type resides in.
public override string? Namespace { get; }
Property Value
Scope
Gets the resolution scope that defines the type.
public override IResolutionScope? Scope { get; }
Property Value
TypeArguments
Gets a collection of type arguments used to instantiate the generic type.
public IList<TypeSignature> TypeArguments { get; }
Property Value
Methods
AcceptVisitor<TResult>(ITypeSignatureVisitor<TResult>)
Visit the current type signature using the provided visitor.
public override TResult AcceptVisitor<TResult>(ITypeSignatureVisitor<TResult> visitor)
Parameters
visitorITypeSignatureVisitor<TResult>The visitor to accept.
Returns
- TResult
The result the visitor produced after visiting this type signature.
Type Parameters
TResultThe type of result the visitor produces.
AcceptVisitor<TState, TResult>(ITypeSignatureVisitor<TState, TResult>, TState)
Visit the current type signature using the provided visitor.
public override TResult AcceptVisitor<TState, TResult>(ITypeSignatureVisitor<TState, TResult> visitor, TState state)
Parameters
visitorITypeSignatureVisitor<TState, TResult>The visitor to accept.
stateTStateAdditional state.
Returns
- TResult
The result the visitor produced after visiting this type signature.
Type Parameters
TStateThe type of additional state.
TResultThe type of result the visitor produces.
GetDirectBaseClass(RuntimeContext?)
Obtains the direct base class of the type signature.
public override TypeSignature? GetDirectBaseClass(RuntimeContext? context)
Parameters
contextRuntimeContext
Returns
- TypeSignature
The type representing the immediate base class.
Remarks
The direct base class is computed according to the rules defined in ECMA-335 I.8.7, where interfaces will extend object, and generic base types will be instantiated with the derived classes type arguments (if any).
GetDirectlyImplementedInterfaces(RuntimeContext?)
Obtains the interfaces that are directly implemented by the type.
public override IEnumerable<TypeSignature> GetDirectlyImplementedInterfaces(RuntimeContext? context)
Parameters
contextRuntimeContext
Returns
- IEnumerable<TypeSignature>
The interfaces.
Remarks
The result set of types is computed according to the rules defined in ECMA-335 I.8.7, where interfaces will extend object, and generic interfaces will be instantiated with the derived classes type arguments (if any).
GetUnderlyingTypeDefOrRef()
Gets the underlying base type signature, without any extra adornments.
public override ITypeDefOrRef GetUnderlyingTypeDefOrRef()
Returns
- ITypeDefOrRef
The base signature.
Remarks
This is not to be confused with GetUnderlyingType(RuntimeContext?), which may resolve enum types to their underlying type representation.
IsDirectlyCompatibleWith(TypeSignature, RuntimeContext?, SignatureComparer)
Determines whether the current type is directly compatible with the provided type.
protected override bool IsDirectlyCompatibleWith(TypeSignature other, RuntimeContext? context, SignatureComparer comparer)
Parameters
otherTypeSignatureThe other type.
contextRuntimeContextThe runtime context to assume when comparing the types.
comparerSignatureComparerThe comparer to use for comparing type signatures.
Returns
- bool
trueif the types are directly compatible,falseotherwise.
Remarks
Type compatibility is determined according to the rules in ECMA-335 I.8.7.1., excluding the transitivity rule.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public override 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.
SetUnderlyingType(ITypeDefOrRef, RuntimeContext?)
Updates the underlying type and value type tag.
public void SetUnderlyingType(ITypeDefOrRef type, RuntimeContext? context)
Parameters
typeITypeDefOrRefThe new type.
contextRuntimeContextThe runtime context to assume when updating the type.
SetUnderlyingType(ITypeDefOrRef, bool)
Updates the underlying type and value type tag.
public void SetUnderlyingType(ITypeDefOrRef type, bool isValueType)
Parameters
typeITypeDefOrRefThe new type.
isValueTypeboolIndicates the type is a value type or not.
WriteContents(in BlobSerializationContext)
Serializes the blob (without extra data) to an output stream.
protected override void WriteContents(in BlobSerializationContext context)
Parameters
contextBlobSerializationContext