diff --git a/src/IndexableSet.cs b/src/IndexableSet.cs index 06be701..14689e1 100644 --- a/src/IndexableSet.cs +++ b/src/IndexableSet.cs @@ -9,7 +9,7 @@ namespace MoonTools.ECS private Dictionary indices; private T[] array; public int Count { get; private set; } - public Enumerator GetEnumerator() => new Enumerator(this); + public Enumerator GetEnumerator() => new Enumerator(this); public IndexableSet(int size = 32) { @@ -70,41 +70,41 @@ namespace MoonTools.ECS } public struct Enumerator - { - /// The set being enumerated. - private readonly IndexableSet _set; - /// The next index to yield. - private int _index; + { + /// The set being enumerated. + private readonly IndexableSet _set; + /// The next index to yield. + private int _index; - /// Initialize the enumerator. - /// The set to enumerate. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal Enumerator(IndexableSet set) - { + /// Initialize the enumerator. + /// The set to enumerate. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal Enumerator(IndexableSet set) + { _set = set; _index = _set.Count; - } + } - /// Advances the enumerator to the next element of the span. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool MoveNext() - { - int index = _index - 1; - if (index >= 0) - { - _index = index; - return true; - } + /// Advances the enumerator to the next element of the span. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool MoveNext() + { + int index = _index - 1; + if (index >= 0) + { + _index = index; + return true; + } - return false; - } + return false; + } - /// Gets the element at the current position of the enumerator. - public T Current - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => _set[_index]; - } - } + /// Gets the element at the current position of the enumerator. + public T Current + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => _set[_index]; + } + } } }