Class ReadOnlyAreaPositionsEnumerable
A custom enumerator used to iterate over all positions within an area with a foreach loop efficiently.
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class ReadOnlyAreaPositionsEnumerable : ValueType
Remarks
This type is a struct, and will either use an indexer-based enumeration method, or a standard IEnumerator, depending on the area's UseIndexEnumeration value. Therefore, it will provide the quickest way of iterating over positions in an area with a for-each loop.
Constructors
ReadOnlyAreaPositionsEnumerable(IReadOnlyArea)
Creates an enumerator which iterates over all positions in the given area.
Declaration
public ReadOnlyAreaPositionsEnumerable(IReadOnlyArea area)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyArea | area | A read-only area containing the positions to iterate over. |
Properties
Current
The current value for enumeration.
Declaration
public Point Current { get; }
Property Value
Type | Description |
---|---|
Point |
Methods
GetEnumerator()
Returns this enumerator.
Declaration
public ReadOnlyAreaPositionsEnumerable GetEnumerator()
Returns
Type | Description |
---|---|
ReadOnlyAreaPositionsEnumerable | This enumerator. |
MoveNext()
Advances the iterator to the next position.
Declaration
public bool MoveNext()
Returns
Type | Description |
---|---|
Boolean | True if the a position within the area was found; false otherwise. |