Class CsvReader<T>
Reads CSV records from a ReadOnlySequence<T>.
public sealed class CsvReader<T> : IDisposable, IAsyncDisposable where T : unmanaged, IBinaryInteger<T>
Type Parameters
T
- Inheritance
-
objectCsvReader<T>
- Implements
Remarks
Internal implementation detail, this type should probably not be used directly.
Constructors
CsvReader(CsvOptions<T>, ICsvBufferReader<T>)
Initializes a new instance of the CsvReader<T> class.
public CsvReader(CsvOptions<T> options, ICsvBufferReader<T> reader)
Parameters
options
CsvOptions<T>reader
ICsvBufferReader<T>
CsvReader(CsvOptions<T>, in ReadOnlySequence<T>)
Initializes a new instance of the CsvReader<T> class.
public CsvReader(CsvOptions<T> options, in ReadOnlySequence<T> csv)
Parameters
options
CsvOptions<T>csv
ReadOnlySequence<T>
CsvReader(CsvOptions<T>, ReadOnlyMemory<T>)
Initializes a new instance of the CsvReader<T> class.
public CsvReader(CsvOptions<T> options, ReadOnlyMemory<T> csv)
Parameters
options
CsvOptions<T>csv
ReadOnlyMemory<T>
Properties
Options
Current options instance.
public CsvOptions<T> Options { get; }
Property Value
- CsvOptions<T>
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
ParseRecords()
Returns an enumerator that iterates through the CSV data.
public CsvReader<T>.RecordEnumerable ParseRecords()
Returns
Remarks
The enumerator advances the inner reader and parser, and disposes them after use.
ParseRecordsAsync(CancellationToken)
Returns an enumerator that asynchronously iterates through the CSV data.
public CsvReader<T>.RecordAsyncEnumerable ParseRecordsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
Remarks
The enumerator advances the inner reader and parser, and disposes them after use.
Reset()
Resets the reader to the beginning of the data source.
public void Reset()
Exceptions
- NotSupportedException
The inner data source does not support rewinding.
TryReset()
Attempts to reset the reader to the beginning of the data source.
public bool TryReset()
Returns
- bool
true
if the inner data source supports rewinding and was successfully reset; otherwisefalse
.