Show / Hide Table of Contents

Struct LayerMaskEnumerator

A type designed to be returned from Layers(uint) in order to enumerate over a set of layers in a layer mask efficiently.

Implements
IEnumerator<int>
IEnumerator
IDisposable
IEnumerable<int>
IEnumerable
Inherited Members
ValueType.Equals(object)
ValueType.GetHashCode()
ValueType.ToString()
object.GetType()
object.Equals(object, object)
object.ReferenceEquals(object, object)
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public struct LayerMaskEnumerator : IEnumerator<int>, IEnumerator, IDisposable, IEnumerable<int>, IEnumerable
Remarks

This type is a struct, and as such is much more efficient than using the otherwise equivalent type of IEnumerable<int> with "yield return". The type does also implement IEnumerable<T>, so it can be used with functions that require one (like System.LINQ); however using this function is not recommended in situations where runtime performance is a primary concern.

This iterator will enumerate the layers in reverse order; ie. highest active number to lowest active number.

Constructors

View Source

LayerMaskEnumerator(uint, int)

Constructs a new enumerator.

Declaration
public LayerMaskEnumerator(uint mask, int numLayers)
Parameters
Type Name Description
uint mask

Layer mask to enumerate.

int numLayers

Number of layers to be considered within the mask.

Properties

View Source

Current

The current value for enumeration.

Declaration
public int Current { get; }
Property Value
Type Description
int

Methods

View Source

GetEnumerator()

Returns this enumerator.

Declaration
public LayerMaskEnumerator GetEnumerator()
Returns
Type Description
LayerMaskEnumerator

This enumerator.

View Source

MoveNext()

Advances the iterator to the next active layer.

Declaration
public bool MoveNext()
Returns
Type Description
bool

True if an active layer was found; false otherwise.

Implements

IEnumerator<T>
IEnumerator
IDisposable
IEnumerable<T>
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>>?)
ToStringExtensions.ExtendToString<T>(IEnumerable<T>, string, Func<T, string>?, string, string)
  • View Source
In this article
Back to top Generated by DocFX