Class VBVariantValue
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
typedValueVBTypedValue
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
handleIBindingHandletypedValueVBTypedValue
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
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
Size
The allocated size (in bytes) of this value.
public override int Size { get; }
Property Value
TypedValue
The wrapped typed value (may be another Variant).
public VBTypedValue TypedValue { get; init; }
Property Value
Value
Gets the underlying managed value corresponding to this typed value.
public VBRuntimeVariantValue Value { get; }
Property Value
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
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
otherIVBTypedValue<VBVariantValue, VBRuntimeVariantValue>An object to compare with this object.
Returns
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
WithValue(VBTypedValue)
public VBVariantValue WithValue(VBTypedValue value)
Parameters
valueVBTypedValue