Struct SpatialMapItemsAtEnumerator<T>
A custom enumerator used to iterate over the item at a given location in a spatial map implementation efficiently.
Generally, you should use GetItemsAt(Point) (or one of its overloads) to get an instance of this, rather than creating one yourself.
Inherited Members
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public struct SpatialMapItemsAtEnumerator<T> : IEnumerable<T>, IEnumerable, IEnumerator<T>, IEnumerator, IDisposable where T : notnull
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
This type is a struct, and as such is notably more efficient when used in a foreach loop than a function returning IEnumerable<T> by using "yield return". This type does implement IEnumerable<T>, so you can pass it to functions which require one (for example, System.LINQ). However, this will have reduced performance due to boxing of the iterator.
Constructors
View SourceSpatialMapItemsAtEnumerator(AdvancedSpatialMap<T>, Point)
Creates an enumerator which iterates over all items at the given point in the spatial map given.
Declaration
public SpatialMapItemsAtEnumerator(AdvancedSpatialMap<T> map, Point position)
Parameters
| Type | Name | Description |
|---|---|---|
| AdvancedSpatialMap<T> | map | The spatial map to check for items in. |
| Point | position | The position to retrieve items at. |
Properties
View SourceCurrent
The current value for enumeration.
Declaration
public T Current { get; }
Property Value
| Type | Description |
|---|---|
| T |
Methods
View SourceGetEnumerator()
Returns this enumerator.
Declaration
public SpatialMapItemsAtEnumerator<T> GetEnumerator()
Returns
| Type | Description |
|---|---|
| SpatialMapItemsAtEnumerator<T> | This enumerator. |
MoveNext()
Advances the iterator to the next item.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool | True if the a new item at the position given; false otherwise. |