Class CsvEnumerable<T>
Lazily projects CSV rows into T instances by binding each property to a fixed field index, for both synchronous and asynchronous enumeration.
[SuppressMessage("Design", "CA1034:Nested types should not be visible", Justification = "Public nested Enumerator/AsyncEnumerator are the standard foreach/await-foreach pattern.")]
public sealed class CsvEnumerable<T> : IEnumerable<T>, IEnumerable, IAsyncEnumerable<T> where T : allows ref struct
Type Parameters
TThe row model type to bind each CSV row to.
- Inheritance
-
CsvEnumerable<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Remarks
The CSV-specialized counterpart to ExcelEnumerable<T>. Because CSV rows are dense
(columns 0..n-1, no gaps) and every cell is text, each data row is parsed in a single indexed
pass — no Row.Cells enumeration, no cell-descriptor re-walk, no per-cell binding search. It
reuses the same compiled ColumnParser<T> delegates as the generic parser, but from the
CSV type-map, where dates parse text rather than Excel serial numbers.
Methods
GetAsyncEnumerator(CancellationToken)
Returns an enumerator that iterates asynchronously through the collection.
public CsvEnumerable<T>.AsyncEnumerator GetAsyncEnumerator(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA CancellationToken that may be used to cancel the asynchronous iteration.
Returns
- CsvEnumerable<T>.AsyncEnumerator
An enumerator that can be used to iterate asynchronously through the collection.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public CsvEnumerable<T>.Enumerator GetEnumerator()
Returns
- CsvEnumerable<T>.Enumerator
An enumerator that can be used to iterate through the collection.