private void CheckVersion() { if (_version != _list._version) { Thrower.EnumeratorCorrupted(); } }
public void Reset() { if (version != collection.version) { Thrower.EnumeratorCorrupted(); } index = 0; current = default(T); }
private void SetNext() { try { if (enumerator.MoveNext()) { next = enumerator.Current; } else { next = new KeyValuePair <Index, T>(new Index { col = matrix.colDim + 1, row = matrix.rowDim + 1 }, default(T)); } } catch (InvalidOperationException) { Thrower.EnumeratorCorrupted(); } }
public bool MoveNext() { if (version != collection.version) { Thrower.EnumeratorCorrupted(); } while ((index < collection.lastIndex)) { if (collection.entries[index].hashCode >= 0) { current = collection.entries[index].item; index++; return(true); } index++; } index = collection.lastIndex + 1; current = default(T); return(false); }
/// <summary> /// Advances the enumerator to the next element of the <see cref="T:Academy.Collections.Generic.SparseMatrix`1"/> /// </summary> /// <returns>true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.</returns> public bool MoveNext() { if (version != matrix.version) { Thrower.EnumeratorCorrupted(); } if (MoveToNextIndex()) { Index index = new Index { row = i, col = j }; T value = default(T); if (comparer.Equals(index, next.Key)) { value = next.Value; SetNext(); } current = new MatrixEntry <T>(index.row, index.col, value); return(true); } i = matrix.RowCount + 1; j = matrix.ColumnCount + 1; return(false); }