public IEnumerable <TDst> RunPipe(bool reuseRowObject) { using (var cursor = _cursorablePipe.GetCursor()) { TDst row = null; while (cursor.MoveNext()) { if (!reuseRowObject || row == null) { row = new TDst(); } cursor.FillValues(row); yield return(row); } } }
public IEnumerable <TDst> RunPipe(bool reuseRowObject) { var curCounter = _counter; using (var cursor = _cursorablePipe.GetCursor()) { TDst row = null; while (cursor.MoveNext()) { if (!reuseRowObject || row == null) { row = new TDst(); } cursor.FillValues(row); yield return(row); if (curCounter != _counter) { throw Contracts.Except("An attempt was made to keep iterating after the pipe has been reset."); } } } }