Table of Contents

Struct ForEachState

Namespace
RDCore.SDK.Runtime.Shared
Assembly
RDCore.SDK.dll

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

Control ITypedSymbol

The bound-variable-expression symbol the loop assigns each element to.

ControlExpression ExpressionNode

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.

Array VBArrayValue

The collection when it is an array, evaluated once and never re-evaluated; null when it is an object.

Index int

For an array, the flat (column-major) index of the element currently assigned to Control. Unused for an object.

Enumerator VBObjectValue

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.

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

VBArrayValue

Control

The bound-variable-expression symbol the loop assigns each element to.

public ITypedSymbol Control { get; init; }

Property Value

ITypedSymbol

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

ExpressionNode

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

VBObjectValue

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; }

Property Value

int