Table of Contents

Class VBArrayValue

Namespace
RDCore.SDK.Model.Values.Intrinsic
Assembly
RDCore.SDK.dll

A VBTypedValue representing a runtime value of the VBArrayType data type.

public abstract record VBArrayValue : VBTypedValue, IEquatable<VBTypedValue>, IEquatable<VBArrayValue>
Inheritance
VBArrayValue
Implements
Derived
Inherited Members

Remarks

👉 The element store is a single flat block of IBindingHandle cells addressed in column-major order (the first subscript varies fastest, as an OLE SAFEARRAY). Bounds live in Dimensions as metadata (LBound/UBound/rank); the cells are mutable storage. An uninitialized array (Dim a()) has no dimensions and no cells.

Constructors

VBArrayValue(IBindingHandle, (int lBound, int uBound)[], VBType)

Creates an array value bound to handle. The array's own binding is a storage concern distinct from the element cells; it is currently inert (see the session-storage follow-up).

protected VBArrayValue(IBindingHandle handle, (int lBound, int uBound)[] dimensions, VBType itemType)

Parameters

handle IBindingHandle
dimensions (int lBound, int uBound)[]
itemType VBType

VBArrayValue(VBArrayValue)

protected VBArrayValue(VBArrayValue original)

Parameters

original VBArrayValue

VBArrayValue((int lBound, int uBound)[], VBType)

Creates an array value with the given dimension bounds and element type.

protected VBArrayValue((int lBound, int uBound)[] dimensions, VBType itemType)

Parameters

dimensions (int lBound, int uBound)[]

The lower and upper bound of each dimension, outermost first.

itemType VBType

The element type. Use VBVariantType when unspecified.

Properties

Dimensions

The bounds of each dimension (outermost first). Empty for an uninitialized array.

public ImmutableArray<VBArrayValue.VBArrayDimension> Dimensions { get; init; }

Property Value

ImmutableArray<VBArrayValue.VBArrayDimension>

IsInitialized

true if this array has at least one dimension.

public bool IsInitialized { get; }

Property Value

bool

this[int[]]

Gets the element at the given subscripts, or null when any subscript is out of bounds (semantics raise SubscriptOutOfRange in that case) or the subscript count does not match the array rank.

public VBTypedValue? this[params int[] subscripts] { get; }

Parameters

subscripts int[]

Property Value

VBTypedValue

ItemType

The declared VBType of the elements in this array.

public VBType ItemType { get; init; }

Property Value

VBType

Length

The total number of elements across every dimension.

public int Length { get; }

Property Value

int

Rank

The number of dimensions of this array. 0 for an uninitialized array.

public int Rank { get; }

Property Value

int

Size

The allocated size (in bytes) of this value.

public override int Size { get; }

Property Value

int

Methods

TryAllocateIn(ISessionStorage, out VBArrayValue?)

Reserves storage sized for this array's own slot through storage, and returns a copy of this value bound to the resulting address. This is the array variable's identity, distinct from its element cells (which remain the same managed storage): a real address is what lets ReDim, Erase, and array-identity comparisons have something to point at, matching how a SAFEARRAY variable's own slot is a pointer, never the array's contents.

public bool TryAllocateIn(ISessionStorage storage, out VBArrayValue? allocated)

Parameters

storage ISessionStorage
allocated VBArrayValue

Returns

bool

false if the underlying memory space is exhausted.

TrySetElement(IBindingHandle, params int[])

Rebinds the element at the given subscripts to value. Mutates the cell in place — array element storage is mutable. Returns false when the subscripts are out of bounds or their count does not match the array rank.

public bool TrySetElement(IBindingHandle value, params int[] subscripts)

Parameters

value IBindingHandle
subscripts int[]

Returns

bool