Struct ForEachState
The hidden per-activation state a For Each loop's opener stashes for its own closer to read
back (MS-VBAL §5.4.2.4): the enumeration cursor over the collection - an array, or an object that is enumerated.
public readonly record struct ForEachState : IEquatable<ForEachState>
- Implements
- Inherited Members
Constructors
ForEachState(ITypedSymbol, ExpressionNode, VBArrayValue?, int, VBObjectValue?)
The hidden per-activation state a For Each loop's opener stashes for its own closer to read
back (MS-VBAL §5.4.2.4): the enumeration cursor over the collection - an array, or an object that is enumerated.
public ForEachState(ITypedSymbol Control, ExpressionNode ControlExpression, VBArrayValue? Array, int Index, VBObjectValue? Enumerator = null)
Parameters
ControlITypedSymbolThe
bound-variable-expressionsymbol the loop assigns each element to.ControlExpressionExpressionNodeThe control variable's own expression node, reused as the location-bearing node for every Let/Set-assignment step a
Nextperforms — never a synthetic stand-in.ArrayVBArrayValueThe collection when it is an array, evaluated once and never re-evaluated; null when it is an object.
IndexintFor an array, the flat (column-major) index of the element currently assigned to Control. Unused for an object.
EnumeratorVBObjectValueThe object that enumerates the collection when it is an object - what its enumeration member (
_NewEnum) returned, once, before the first member was asked for; null when the collection is an array. It is positioned at the member currently assigned to Control.
Properties
Array
The collection when it is an array, evaluated once and never re-evaluated; null when it is an object.
public VBArrayValue? Array { get; init; }
Property Value
Control
The bound-variable-expression symbol the loop assigns each element to.
public ITypedSymbol Control { get; init; }
Property Value
ControlExpression
The control variable's own expression node, reused as the location-bearing node for every
Let/Set-assignment step a Next performs — never a synthetic stand-in.
public ExpressionNode ControlExpression { get; init; }
Property Value
Enumerator
The object that enumerates the collection when it is an object - what its enumeration member (_NewEnum) returned, once, before the first member was
asked for; null when the collection is an array. It is positioned at the member currently assigned to Control.
public VBObjectValue? Enumerator { get; init; }
Property Value
Index
For an array, the flat (column-major) index of the element currently assigned to Control. Unused for an object.
public int Index { get; init; }