Table of Contents

Class VariantReferenceBindingHandle

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

A Variant that refers to a variable of another declared type: what an element of a param array is when the argument it was given is a variable (MS-VBAL §5.3.1.5: the param array "behaves as if it was an array whose elements were 'byref' <positional-param> elements whose declared types were Variant").

public sealed record VariantReferenceBindingHandle : IKnowledgeBinding, IBindingHandle, IEquatable<VariantReferenceBindingHandle>
Inheritance
VariantReferenceBindingHandle
Implements
Inherited Members
Extension Methods

Remarks

Read, it is a Variant holding the variable's value, as the type the variable is declared: TypeName(a(0)) of a Long is Long. Written, it is the variable that is written, which holds a value of its declared type only: what is assigned to the element is let- or set-coerced to DeclaredType before it is stored (DeclaredTypeOf(IBindingHandle?, VBType)), as an assignment to the variable would be - a String no Long can hold is a type mismatch, and leaves the variable as it was.

A variable declared Variant holds a Variant already, which is read and written as it is: the handle says only that the element is a variable, which a server is given by reference (VT_BYREF) when the param array is a late-bound member's arguments.

Constructors

VariantReferenceBindingHandle(IBindingHandle, VBType)

A Variant that refers to a variable of another declared type: what an element of a param array is when the argument it was given is a variable (MS-VBAL §5.3.1.5: the param array "behaves as if it was an array whose elements were 'byref' <positional-param> elements whose declared types were Variant").

public VariantReferenceBindingHandle(IBindingHandle Variable, VBType DeclaredType)

Parameters

Variable IBindingHandle

The cell of the variable the element refers to.

DeclaredType VBType

The declared type of the variable.

Remarks

Read, it is a Variant holding the variable's value, as the type the variable is declared: TypeName(a(0)) of a Long is Long. Written, it is the variable that is written, which holds a value of its declared type only: what is assigned to the element is let- or set-coerced to DeclaredType before it is stored (DeclaredTypeOf(IBindingHandle?, VBType)), as an assignment to the variable would be - a String no Long can hold is a type mismatch, and leaves the variable as it was.

A variable declared Variant holds a Variant already, which is read and written as it is: the handle says only that the element is a variable, which a server is given by reference (VT_BYREF) when the param array is a late-bound member's arguments.

Properties

BindingCapabilities

Indicates the valid members of this binding.

public BindingCapabilities BindingCapabilities { get; }

Property Value

BindingCapabilities

DeclaredType

The declared type of the variable.

public VBType DeclaredType { get; init; }

Property Value

VBType

IsKnown

Whether the value held is known. When it is not, the value held is the one its type assumes.

public bool IsKnown { get; }

Property Value

bool

Value

The bound runtime value, read without a resolver.

public IRuntimeValue Value { get; }

Property Value

IRuntimeValue

Remarks

👉 A direct read for the common literal/value cases. Handles that resolve a value lazily or via a reference still expose GetValue(ISymbolResolver).

Exceptions

NotSupportedException

The binding has no readable value.

Variable

The cell of the variable the element refers to.

public IBindingHandle Variable { get; init; }

Property Value

IBindingHandle

Methods

DeclaredTypeOf(IBindingHandle?, VBType)

The declared type a value assigned through cell is coerced to: the referenced variable's, for a VariantReferenceBindingHandle, and itemType, the element type of the array, for any other cell.

public static VBType DeclaredTypeOf(IBindingHandle? cell, VBType itemType)

Parameters

cell IBindingHandle

The cell of an element, or null for an element that has none.

itemType VBType

The element type of the array the element is of.

Returns

VBType

Forget()

Makes the value held not known, keeping it as the value assumed in its place.

public void Forget()

GetValue(ISymbolResolver)

Gets the value associated to this handle, resolving through resolver when the binding is not self-contained.

public IRuntimeValue GetValue(ISymbolResolver resolver)

Parameters

resolver ISymbolResolver

Returns

IRuntimeValue

Remarks

👉 Verify that the binding supports GetValue.

Exceptions

NotSupportedException

Invoke(ISymbolResolver, IRuntimeValue[])

Invokes the callable entity associated to this handle, and returns the runtime value it yields - an HRESULT (S_OK), for one that yields no value.

public IRuntimeValue Invoke(ISymbolResolver resolver, IRuntimeValue[] args)

Parameters

resolver ISymbolResolver
args IRuntimeValue[]

Returns

IRuntimeValue

Remarks

👉 Verify that the binding supports Invoke.
A handle to code that runs on a call stack does not push the frame itself: it hands the call to an IProcedureInvoker.

Exceptions

NotSupportedException

The binding does not support Invoke.

VBRuntimeErrorException

A run-time error was raised by the invoked entity and nothing handled it.

SetValue(ISymbolResolver, IRuntimeValue)

Sets the value associated to this handle.

public void SetValue(ISymbolResolver resolver, IRuntimeValue value)

Parameters

resolver ISymbolResolver
value IRuntimeValue

Remarks

👉 Verify that the binding supports SetValue.

Exceptions

NotSupportedException

Store(IRuntimeValue, bool)

Replaces the value held, and says whether the new value is known.

public void Store(IRuntimeValue value, bool isKnown)

Parameters

value IRuntimeValue

The new value, or the value assumed in place of one that is not known.

isKnown bool

Whether value is known.