Table of Contents

Class CsvValueEnumeratorBase<T, TValue>

Namespace
FlameCsv.Enumeration
Assembly
FlameCsv.Core.dll

An enumerator that parses CSV records as TValue.

public abstract class CsvValueEnumeratorBase<T, TValue> : CsvEnumeratorBase<T>, IEnumerator<TValue>, IEnumerator, IDisposable, IAsyncEnumerator<TValue>, IAsyncDisposable where T : unmanaged, IBinaryInteger<T>

Type Parameters

T
TValue
Inheritance
object
CsvValueEnumeratorBase<T, TValue>
Implements
IEnumerator<TValue>
Derived
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

CsvValueEnumeratorBase(CsvOptions<T>, ICsvBufferReader<T>, CancellationToken)

Initializes a new instance of CsvValueEnumeratorBase<T, TValue>.

protected CsvValueEnumeratorBase(CsvOptions<T> options, ICsvBufferReader<T> reader, CancellationToken cancellationToken)

Parameters

options CsvOptions<T>

Options to use for reading

reader ICsvBufferReader<T>

Data source

cancellationToken CancellationToken

Token to cancel asynchronous enumeration

Properties

Current

Value parsed from the current CSV record.

public TValue Current { get; }

Property Value

TValue

Headers

Returns the headers in the CSV.

protected ImmutableArray<string> Headers { get; }

Property Value

ImmutableArray<string>

Exceptions

NotSupportedException

A non-null value is set when HasHeader is false.

Methods

BindToHeaderless()

Returns a materializer bound to field indexes.

protected abstract IMaterializer<T, TValue> BindToHeaderless()

Returns

IMaterializer<T, TValue>

BindToHeaders(ImmutableArray<string>)

Returns a materializer bound to headers.

protected abstract IMaterializer<T, TValue> BindToHeaders(ImmutableArray<string> headers)

Parameters

headers ImmutableArray<string>

Returns

IMaterializer<T, TValue>

GetHeader()

Returns the header record's fields, or empty if none is read.

protected override ImmutableArray<string> GetHeader()

Returns

ImmutableArray<string>

ResetHeader()

Resets the header. No-op if the header is not read.

protected override void ResetHeader()