Class CsvValueEnumerator<T, TValue>
- Namespace
- FlameCsv.Enumeration
- Assembly
- FlameCsv.Core.dll
An enumerator that parses CSV records as TValue
.
[RequiresUnreferencedCode("This code path uses reflection. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
[RequiresDynamicCode("This code path uses compiled expressions. Use the overloads accepting source generated CsvTypeMap for AOT/trimming compatible code.")]
public sealed class CsvValueEnumerator<T, TValue> : CsvValueEnumeratorBase<T, TValue>, IEnumerator<TValue>, IEnumerator, IDisposable, IAsyncEnumerator<TValue>, IAsyncDisposable where T : unmanaged, IBinaryInteger<T>
Type Parameters
T
TValue
- Inheritance
-
CsvValueEnumeratorBase<T, TValue>CsvValueEnumerator<T, TValue>
- Implements
-
IEnumerator<TValue>IAsyncEnumerator<TValue>
- Inherited Members
Remarks
If the options are configured to read a header record, it will be processed first before any records are yielded.
This class is not thread-safe, and should not be used concurrently.
The enumerator should always be disposed after use, either explicitly or using foreach
.
Constructors
CsvValueEnumerator(CsvOptions<T>, ICsvPipeReader<T>, CancellationToken)
Initializes a new instance of CsvValueEnumerator<T, TValue>.
public CsvValueEnumerator(CsvOptions<T> options, ICsvPipeReader<T> reader, CancellationToken cancellationToken = default)
Parameters
options
CsvOptions<T>Options to use for reading
reader
ICsvPipeReader<T>Data source
cancellationToken
CancellationTokenToken to cancel asynchronous enumeration
Methods
BindToHeaderless()
Returns a materializer bound to field indexes.
protected override IMaterializer<T, TValue> BindToHeaderless()
Returns
- IMaterializer<T, TValue>
BindToHeaders(ReadOnlySpan<string>)
Returns a materializer bound to headers
.
protected override IMaterializer<T, TValue> BindToHeaders(ReadOnlySpan<string> headers)
Parameters
headers
ReadOnlySpan<string>
Returns
- IMaterializer<T, TValue>