Struct ScyllaStack<T>.Enumerator
Value-type enumerator for ScyllaStack<T> that produces elements in top-to-bottom order without heap allocation.
Inherited Members
Namespace: Scylla.Core.Structures
Assembly: ScyllaCore.dll
Syntax
public struct ScyllaStack<T>.Enumerator
Remarks
This enumerator is intentionally a struct to enable allocation-free
foreach iteration when used against the concrete ScyllaStack<T>
type. It does not implement IEnumerator<T>
to avoid boxing. The enumerator does not detect concurrent modifications; it snapshots
Count at construction time and will stop after that many
elements regardless of subsequent changes.
Constructors
Enumerator(ScyllaStack<T>)
Initializes a new ScyllaStack<T>.Enumerator for the given stack.
Declaration
public Enumerator(ScyllaStack<T> stack)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaStack<T> | stack | The stack to enumerate. The enumerator captures a count snapshot from this instance. |
Properties
Current
Gets the element at the current enumerator position.
Valid only after a call to MoveNext() has returned true.
Declaration
public readonly T Current { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
MoveNext()
Advances the enumerator to the next element in top-to-bottom order.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
On the first call, the enumerator moves to the element at the top of the stack
(the last element pushed). On each subsequent call it moves one position toward
the bottom. Returns false once all elements have been yielded.