Struct ScyllaSquareGrid<TCell>.Enumerator
Value-type enumerator for ScyllaSquareGrid<TCell> that enables
allocation-free foreach iteration when used on the concrete type.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaSquareGrid<TCell>.Enumerator
Remarks
Yields (SquareCoord Coord, TCell Value) tuples in row-major order (left to
right within each row, top to bottom across rows). The enumerator captures the grid's
internal version at construction and throws InvalidOperationException
if the grid is mutated during iteration.
Constructors
Enumerator(ScyllaSquareGrid<TCell>)
Initializes a new ScyllaSquareGrid<TCell>.Enumerator for the given grid.
Declaration
public Enumerator(ScyllaSquareGrid<TCell> grid)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaSquareGrid<TCell> | grid | The grid to enumerate. Must not be |
Properties
Current
Gets the coordinate and cell value at the current iteration position.
Declaration
public readonly (SquareCoord Coord, TCell Value) Current { get; }
Property Value
| Type | Description |
|---|---|
| (SquareCoord Coord, TCell Value) | A tuple |
Methods
MoveNext()
Advances the enumerator to the next cell.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
|
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Thrown if the grid was modified (via any setter or Fill(TCell)) after this enumerator was created. |