Show / Hide Table of Contents

Class ReadOnlyAreaPositionsEnumerator

A custom enumerator used to iterate over all positions within an area with a foreach loop efficiently.

Inheritance
Object
ReadOnlyAreaPositionsEnumerator
Implements
IEnumerator<Point>
IEnumerator
IDisposable
IEnumerable<Point>
IEnumerable
Namespace: SadRogue.Primitives
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class ReadOnlyAreaPositionsEnumerator : ValueType, IEnumerator<Point>, IEnumerator, IDisposable, IEnumerable<Point>, IEnumerable
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.

If you have a value of a concrete type rather than an interface, and the GetEnumerator implementation for that given type is particularly fast or a non-boxed type (like Area, you will probably get faster performance out of that than by using this; however this will provide better performance if you are working with an interface and thus don't know the type of area. Use cases for this class are generally for iteration via IReadOnlyArea.

Constructors

ReadOnlyAreaPositionsEnumerator(IReadOnlyArea)

Creates an enumerator which iterates over all positions in the given area.

Declaration
public ReadOnlyAreaPositionsEnumerator(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 ReadOnlyAreaPositionsEnumerator GetEnumerator()
Returns
Type Description
ReadOnlyAreaPositionsEnumerator

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.

Implements

System.Collections.Generic.IEnumerator<T>
System.Collections.IEnumerator
System.IDisposable
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>, EventHandler<ValueChangedEventArgs<TProperty>>)
In This Article
Back to top Generated by DocFX