Class CustomModifierTypeSignature
- Namespace
- AsmResolver.DotNet.Signatures
- Assembly
- AsmResolver.DotNet.dll
Represents a type signature that is annotated with a required or optional custom modifier type.
public class CustomModifierTypeSignature : TypeSpecificationSignature, ITypeDescriptor, IMemberDescriptor, IFullNameProvider, INameProvider, IModuleProvider, IImportable
- Inheritance
-
CustomModifierTypeSignature
- Implements
- Inherited Members
- Extension Methods
Constructors
CustomModifierTypeSignature(ITypeDefOrRef, bool, TypeSignature)
Creates a new type signature annotated with a modifier type.
public CustomModifierTypeSignature(ITypeDefOrRef modifierType, bool isRequired, TypeSignature baseType)
Parameters
modifierType
ITypeDefOrRefThe modifier type.
isRequired
boolIndicates whether the modifier is required or optional.
baseType
TypeSignatureThe type signature that was annotated.
Properties
ElementType
Gets the element type of the
public override ElementType ElementType { get; }
Property Value
IsOptional
Gets or sets a value indicating whether the custom modifier type is an optional modifier.
public bool IsOptional { get; set; }
Property Value
IsRequired
Gets or sets a value indicating whether the custom modifier type is a required modifier.
public bool IsRequired { get; set; }
Property Value
IsValueType
Gets a value indicating whether instances of this type are passed on by value or by reference.
public override bool IsValueType { get; }
Property Value
ModifierType
Gets or sets the type representing the modifier that is added to the type.
public ITypeDefOrRef ModifierType { get; set; }
Property Value
Name
Gets the name of the object.
public override string Name { 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
visitor
ITypeSignatureVisitor<TResult>The visitor to accept.
Returns
- TResult
The result the visitor produced after visiting this type signature.
Type Parameters
TResult
The 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
visitor
ITypeSignatureVisitor<TState, TResult>The visitor to accept.
state
TStateAdditional state.
Returns
- TResult
The result the visitor produced after visiting this type signature.
Type Parameters
TState
The type of additional state.
TResult
The type of result the visitor produces.
GetDirectBaseClass()
Obtains the direct base class of the type signature.
public override TypeSignature? GetDirectBaseClass()
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).
GetIntermediateType()
Obtains the intermediate type of the type signature.
public override TypeSignature GetIntermediateType()
Returns
- TypeSignature
The intermediate type.
Remarks
As per ECMA-335 I.8.7, intermediate types are a subset of the built-in value types can be represented on the evaluation stack.
GetReducedType()
Obtains the reduced type of the type signature.
public override TypeSignature GetReducedType()
Returns
- TypeSignature
The reduced type.
Remarks
As per ECMA-335 I.8.7, the reduced type ignores the semantic differences between enumerations and the signed and unsigned integer types; treating these types the same if they have the same number of bits.
GetVerificationType()
Obtains the verification type of the type signature.
public override TypeSignature GetVerificationType()
Returns
- TypeSignature
The verification type.
Remarks
As per ECMA-335 I.8.7, the verification type ignores the semantic differences between enumerations, characters, booleans, the signed and unsigned integer types, and managed pointers to any of these; treating these types the same if they have the same number of bits or point to types with the same number of bits.
IsImportedInModule(ModuleDefinition)
Determines whether the descriptor of the member is fully imported in the provided module.
public override 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.
StripModifiers()
Strips any top-level custom type modifier and pinned type annotations from the signature.
public override TypeSignature StripModifiers()
Returns
- TypeSignature
The stripped type signature.
Remarks
This method does not necessarily recursively strip away every modifier type from the signature, nor does it allocate new type signatures or change existing ones. It only traverses the type signature until a non-modifier or pinned type is encountered. Annotations that are embedded in the type signature (e.g., as a type argument of a generic instance type), will not be automatically removed.
WriteContents(in BlobSerializationContext)
Serializes the blob (without extra data) to an output stream.
protected override void WriteContents(in BlobSerializationContext context)
Parameters
context
BlobSerializationContext