Table of Contents

Struct CsvRecordCallbackArgs<T>

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Arguments for CsvRecordCallback<T>.

public readonly ref struct CsvRecordCallbackArgs<T> where T : unmanaged, IBinaryInteger<T>

Type Parameters

T

Token type

Constructors

CsvRecordCallbackArgs(CsvRecordRef<T>, ImmutableArray<string>, ref bool, ref bool)

Initializes a new instance of CsvRecordCallbackArgs<T>.

public CsvRecordCallbackArgs(CsvRecordRef<T> record, ImmutableArray<string> header, ref bool skip, ref bool headerRead)

Parameters

record CsvRecordRef<T>
header ImmutableArray<string>
skip bool
headerRead bool

Properties

Header

Returns the header record if HeaderRead is true, empty otherwise.

public ReadOnlySpan<string> Header { get; }

Property Value

ReadOnlySpan<string>

HeaderRead

Whether the header has been read. If this is set to false when the callback returns, the header is re-read.

public bool HeaderRead { get; set; }

Property Value

bool

Remarks

If the set to false while reading headered CSV, this record will be considered the header unless SkipRecord is also true, in which case it will be first unskipped record.
Modifying the value throws a NotSupportedException in parallel workloads.

IsEmpty

Returns true if the record has a length of 0.

public bool IsEmpty { get; }

Property Value

bool

Remarks

An empty record's field count is always 1 (it contains a single empty field).

LineNumber

Returns the 1-based line number of the record in the source data.

public int LineNumber { get; }

Property Value

int

Remarks

Lines are counted as CSV records; newlines inside quoted fields are not counted.

Options

Options instance.

public CsvOptions<T> Options { get; }

Property Value

CsvOptions<T>

Position

Returns the 0-based position of the start of the first field of the record in the source data.

public long Position { get; }

Property Value

long

Remarks

If T is char, this is the character position, even if the data is from a byte stream.

Record

The current CSV record.

[UnscopedRef]
public ref readonly CsvRecordRef<T> Record { get; }

Property Value

CsvRecordRef<T>

SkipRecord

Set to true to skip this record.

public bool SkipRecord { get; set; }

Property Value

bool