Class DataValues
Copies a data value (MS-VBAL §2.1) the way an assignment does: deeply, so that the copy shares no storage with the value it was copied from.
public static class DataValues
- Inheritance
-
DataValues
- Inherited Members
Remarks
A Let-coercion's result is "a copy of the source value" (MS-VBAL §5.5.1.2.12, and each table of §5.5.1.2). An array and a
user-defined type are made of cells (an element's, a field's), and a copy that shared them with its source would be the source by another name:
w = v: w(0) = 9 would change v(0), and the object an element held would have one holder where there are two. Every cell of the
copy is a new one holding a copy of what the source cell holds, the whole way down - an array a Variant element holds, a user-defined
type a field is. What a cell knows of its value is kept.
👉 Not a with expression: a record's with makes a new view of the same storage, which is what binding a value to its
variable's address needs (TryAllocateIn(ISessionStorage, out VBArrayValue?)). An object is its reference, and a copy of it is the same object; a
number, a String and every other intrinsic value is immutable - but one read from a variable is bound to the variable's cell, and its
copy is bound to a cell of its own that holds what the variable held when it was copied.
Methods
Copy(VBTypedValue)
A copy of value that shares no cell with it.
public static VBTypedValue Copy(VBTypedValue value)
Parameters
valueVBTypedValueThe value to copy.
Returns
- VBTypedValue
The copy;
valueitself when it holds no cell to share.
CopyCell(IBindingHandle)
A new cell that holds a copy of what cell holds, and knows of it what cell does.
public static IBindingHandle CopyCell(IBindingHandle cell)
Parameters
cellIBindingHandleAn element's cell, or a field's.
Returns
- IBindingHandle
The new cell - the cell's own copy, when it makes one (ICopyableBinding);
cellitself when it holds nothing that can be read, which a write replaces rather than writes to.
CopyRuntimeValue(IRuntimeValue)
A copy of a value as a cell stores it: an array, a user-defined type and a Variant are boxed (SymbolAddressTable.BoxedValue),
and their boxes are copied with what they hold.
public static IRuntimeValue CopyRuntimeValue(IRuntimeValue value)
Parameters
valueIRuntimeValueThe stored value.