public IEnumerable <CatalogImportItem> ReadBuffer() { if (ReadedCount != -1) { throw new Exception(@"Уже читается"); } Task.Factory.StartNew(BufferWriterRoutine); return(_buffer.PopAsEnumerable()); }
private IEnumerable <PartItem> ReadBuffer() { int itemsCount = 0; foreach (var item in _buffer.PopAsEnumerable()) { _writenCount++; yield return(BuildPartItem(item)); if (itemsCount++ > ContextItemsThreshold) { yield break; } } }