public IEnumerator GetEnumerator()
{
- return new ArrayEnumerator(_array, 0, Count);
+ return new ArrayEnumerator(_array, Count);
}
int ICollection.Count
public IEnumerator GetEnumerator()
{
- return new ArrayEnumerator(_array, 0, Count);
+ return new ArrayEnumerator(_array, Count);
}
int ICollection.Count
public IEnumerator GetEnumerator()
{
- return new ArrayEnumerator(_array, 0, Count);
+ return new ArrayEnumerator(_array, Count);
}
int ICollection.Count
public IEnumerator GetEnumerator()
{
- return new ArrayEnumerator(_array, 0, Count);
+ return new ArrayEnumerator(_array, Count);
}
int ICollection.Count
private class ArrayEnumerator : IEnumerator
{
private readonly object[] _array;
- private object _item;
- private int _index;
- private readonly int _startIndex;
private readonly int _endIndex;
+ private int _index;
+ private object _item;
- public ArrayEnumerator(object[] array, int startIndex, int count)
+ public ArrayEnumerator(object[] array, int count)
{
_array = array;
- _startIndex = startIndex;
- _endIndex = _index + count;
-
- _index = _startIndex;
- }
-
- public object Current
- {
- get
- {
- return _item;
- }
+ _endIndex = count;
}
+ public object Current => _item;
public bool MoveNext()
{
public void Reset()
{
// Position enumerator before first item
-
- _index = _startIndex;
+ _index = 0;
_item = null;
}
}