Table of Contents

Class VBVariantValue

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

Represents a Variant value.

public record VBVariantValue : VBTypedValue, IEquatable<VBTypedValue>, IVBTypedValue<VBVariantValue, VBRuntimeVariantValue>, IEquatable<IVBTypedValue<VBVariantValue, VBRuntimeVariantValue>>, IEquatable<VBVariantValue>
Inheritance
VBVariantValue
Implements
Inherited Members

Remarks

👉 The managed type of this value is a VBRuntimeVariantValue, which boxes TypedValue itself so a fresh Variant round-trips through ISessionStorage intact: reading one back (CreateValue(IBindingHandle)) unboxes the very same wrapped value, never a fresh, unrelated Empty.

Constructors

VBVariantValue(VBTypedValue)

Creates a Variant wrapping typedValue, self-consistently bound: its own Handle boxes typedValue directly, so reading this value straight back through RuntimeValue never throws.

public VBVariantValue(VBTypedValue typedValue)

Parameters

typedValue VBTypedValue

VBVariantValue(IBindingHandle, VBTypedValue)

Creates a Variant wrapping typedValue and bound to handle directly — used when unboxing one already read back from storage.

public VBVariantValue(IBindingHandle handle, VBTypedValue typedValue)

Parameters

handle IBindingHandle
typedValue VBTypedValue

Properties

IsSubtypeKnown

Whether the subtype of this Variant is known: false for one an analysis knows nothing of but that it is a Variant.

public bool IsSubtypeKnown { get; }

Property Value

bool

Remarks

A Variant whose value is not known still has a subtype that is, when what it holds was given a type - v = x * 1.5 holds a Double, whatever x is - and the effective type of an operation of it is that subtype's. One whose subtype is not known holds an Empty that is not known either (OfUnknownSubtype()): an Empty has one value, so an Empty that is not known can only be a subtype that is not. Nothing is planned on the Empty it assumes: an operation of it has no effective type that is known.

ReferencedType

The declared type of the variable this is the value of, when it was passed by reference to a Variant parameter of the standard library and is declared as another type - an array, a number - which MS-VBA tells apart from a Variant that holds the same value (Runtime.Abstract.StdLib.StdLibByRefAttribute); null otherwise.

public VBType? ReferencedType { get; init; }

Property Value

VBType

Size

The allocated size (in bytes) of this value.

public override int Size { get; }

Property Value

int

TypedValue

The wrapped typed value (may be another Variant).

public VBTypedValue TypedValue { get; init; }

Property Value

VBTypedValue

Value

Gets the underlying managed value corresponding to this typed value.

public VBRuntimeVariantValue Value { get; }

Property Value

VBRuntimeVariantValue

Methods

AsAssumed()

Returns what an analysis assumes of this value where it does not trust it - a variable it reads, a value nothing says anything of but its declared type: a copy whose value is not known (AsIndeterminate()).

public override VBTypedValue AsAssumed()

Returns

VBTypedValue

Remarks

👉 A Variant that holds Empty, the value every Variant starts as, says nothing of the value it will hold: its subtype is not known either (IsSubtypeKnown). One that holds a value of another subtype keeps it.

Equals(IVBTypedValue<VBVariantValue, VBRuntimeVariantValue>?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(IVBTypedValue<VBVariantValue, VBRuntimeVariantValue>? other)

Parameters

other IVBTypedValue<VBVariantValue, VBRuntimeVariantValue>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

OfUnknownSubtype()

A Variant that is not known, of a subtype that is not known either: what an analysis knows of a Variant nothing has said anything of.

public static VBVariantValue OfUnknownSubtype()

Returns

VBVariantValue

WithValue(VBTypedValue)

public VBVariantValue WithValue(VBTypedValue value)

Parameters

value VBTypedValue

Returns

VBVariantValue