Summary
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.
- Assembly
- Animancer
.dll - Namespace
- Animancer
- Interfaces
- Base Types
-
- ValueType
graph BT
Type-->Base0["ValueType"]
Type-.->Interface0["IList<T>"]
Type-.->Interface1["IEnumerator<T>"]
Type["FastEnumerator<T>"]
class Type type-node
Syntax
public struct FastEnumerator<T> : ValueType, IList<T>, IEnumerator<T>
Examples
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))
{
Debug.Log(number);
}
// Log Output:
// 9
// 8
// 7
// 6
Remarks
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 |
---|---|
T |
Constructors
Name | Summary |
---|---|
FastEnumerator |
Creates a new Animancer.FastEnumerator`1 . |
FastEnumerator |
Creates a new Animancer.FastEnumerator`1 . |
Properties
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 . |
Methods
Name | Value | Summary |
---|---|---|
Add |
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 |
bool |
[
System.Collections.Generic.ICollection`1 ] Does the Animancer.FastEnumerator`1.List contain the `item`? |
CopyTo |
void |
[
System.Collections.Generic.ICollection`1 ] Copies the contents of the Animancer.FastEnumerator`1.List into the `array`. |
GetEnumerator |
FastEnumerator |
Returns
this . |
IndexOf |
int |
[
System.Collections.Generic.IList`1 ] Returns the first index of the `item` in the Animancer.FastEnumerator`1.List . |
Insert |
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 |
bool |
[
System.Collections.Generic.ICollection`1 ] Removes the `item` from the Animancer.FastEnumerator`1.List and returns true if successful. |
RemoveAt |
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 . |