FastEnumerator<T> Struct


An System.Collections.Generic.IEnumerator`1 for any System.Collections.Generic.IList`1 doesn't bother checking if the target has been modified. This gives it good performance but also makes it slightly less safe to use.
  • IList<T>
  • IEnumerator<T>
Base Types
  • ValueType
graph BT Type-->Base0["ValueType"] Type-.->Interface0["IList<T>"] Type-.->Interface1["IEnumerator<T>"] Type["FastEnumerator<T>"] class Type type-node


public struct FastEnumerator<T> : ValueType, IList<T>, IEnumerator<T>


var numbers = new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, };
var count = 4;
foreach (var number in new FastEnumerator<int>(numbers, count))

// Log Output:
// 9
// 8
// 7
// 6


This struct also implements System.Collections.Generic.IEnumerable`1 so it can be used in foreach statements and System.Collections.Generic.IList`1 to allow the target collection to be modified without breaking the enumerator (though doing so is still somewhat dangerous so use with care).

Type Parameters

Name Description


Name Summary
FastEnumerator(IList<T>) Creates a new Animancer.FastEnumerator`1.
FastEnumerator(IList<T>, int) Creates a new Animancer.FastEnumerator`1.


Name Value Summary
Count int
[System.Collections.Generic.ICollection`1] The number of items in the Animancer.FastEnumerator`1.List (which can be less than the System.Collections.Generic.ICollection`1.Count of the Animancer.FastEnumerator`1.List).
Current T
The item at the current Animancer.FastEnumerator`1.Index in the Animancer.FastEnumerator`1.List.
Index int
The position of the Animancer.FastEnumerator`1.Current item in the Animancer.FastEnumerator`1.List.
IsReadOnly bool
[System.Collections.Generic.ICollection`1] Is the Animancer.FastEnumerator`1.List read-only?
this[int] T
[System.Collections.Generic.IList`1] The item at the specified `index` in the Animancer.FastEnumerator`1.List.


Name Value Summary
Add(T) void
[System.Collections.Generic.ICollection`1] Adds the `item` to the end of the Animancer.FastEnumerator`1.List.
Clear() void
[System.Collections.Generic.ICollection`1] Removes everything from the Animancer.FastEnumerator`1.List.
Contains(T) bool
[System.Collections.Generic.ICollection`1] Does the Animancer.FastEnumerator`1.List contain the `item`?
CopyTo(T[], int) void
[System.Collections.Generic.ICollection`1] Copies the contents of the Animancer.FastEnumerator`1.List into the `array`.
GetEnumerator() FastEnumerator<T>
Returns this.
IndexOf(T) int
[System.Collections.Generic.IList`1] Returns the first index of the `item` in the Animancer.FastEnumerator`1.List.
Insert(int, T) void
[System.Collections.Generic.IList`1] Inserts the `item` at the specified `index` in the Animancer.FastEnumerator`1.List.
MoveNext() bool
Moves to the next item in the Animancer.FastEnumerator`1.List and returns true if there is one.
MovePrevious() bool
Moves to the previous item in the Animancer.FastEnumerator`1.List and returns true if there is one.
Remove(T) bool
[System.Collections.Generic.ICollection`1] Removes the `item` from the Animancer.FastEnumerator`1.List and returns true if successful.
RemoveAt(int) void
[System.Collections.Generic.IList`1] Removes the item at the specified `index` from the Animancer.FastEnumerator`1.List.
Reset() void
[System.Collections.IEnumerator] Reverts this enumerator to the start of the Animancer.FastEnumerator`1.List.