Table of Contents

Class ArrayTypeSignature

Namespace
AsmResolver.DotNet.Signatures
Assembly
AsmResolver.DotNet.dll

Represents a single (complex) array type signature, which encodes a variable amount of array dimensions, as well as their sizes and lower bounds.

public class ArrayTypeSignature : ArrayBaseTypeSignature, ITypeDescriptor, IMemberDescriptor, IFullNameProvider, INameProvider, IModuleProvider, IImportable
Inheritance
ArrayTypeSignature
Implements
Inherited Members
Extension Methods

Remarks

For simple single-dimension arrays, use SzArrayTypeSignature instead.

Constructors

ArrayTypeSignature(TypeSignature)

Creates a new array type signature.

public ArrayTypeSignature(TypeSignature baseType)

Parameters

baseType TypeSignature

The element type.

ArrayTypeSignature(TypeSignature, params ArrayDimension[])

Creates a new array type signature with the provided dimensions count.

public ArrayTypeSignature(TypeSignature baseType, params ArrayDimension[] dimensions)

Parameters

baseType TypeSignature

The element type.

dimensions ArrayDimension[]

The dimensions.

ArrayTypeSignature(TypeSignature, int)

Creates a new array type signature with the provided dimensions count.

public ArrayTypeSignature(TypeSignature baseType, int dimensionCount)

Parameters

baseType TypeSignature

The element type.

dimensionCount int

The number of dimensions.

Properties

Dimensions

Gets a collection of dimensions.

public IList<ArrayDimension> Dimensions { get; }

Property Value

IList<ArrayDimension>

ElementType

Gets the element type of the

public override ElementType ElementType { get; }

Property Value

ElementType

Name

Gets the name of the object.

public override string Name { get; }

Property Value

string

Rank

Gets the number of dimensions this array defines.

public override int Rank { get; }

Property Value

int

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 TState

Additional 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.

GetDimensions()

Obtains the dimensions this array defines.

public override IEnumerable<ArrayDimension> GetDimensions()

Returns

IEnumerable<ArrayDimension>

The dimensions.

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).

Validate()

Verifies that the array signature only contains dimensions that are valid.

public bool Validate()

Returns

bool

Remarks

An array signature is valid if all bounded dimensions are in the front of the dimensions list.

WriteContents(in BlobSerializationContext)

Serializes the blob (without extra data) to an output stream.

protected override void WriteContents(in BlobSerializationContext context)

Parameters

context BlobSerializationContext