Table of Contents

Struct CsvExceptionHandlerArgs<T>

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Arguments for CsvExceptionHandler<T>.

public readonly struct CsvExceptionHandlerArgs<T> where T : unmanaged, IBinaryInteger<T>

Type Parameters

T

Token type

Constructors

CsvExceptionHandlerArgs(in CsvFields<T>, ImmutableArray<string>, Exception, int, long)

Initializes a new instance of CsvExceptionHandlerArgs<T>.

public CsvExceptionHandlerArgs(in CsvFields<T> fields, ImmutableArray<string> header, Exception exception, int lineIndex, long position)

Parameters

fields CsvFields<T>
header ImmutableArray<string>
exception Exception
lineIndex int
position long

Properties

Exception

Exception thrown.

public Exception Exception { get; }

Property Value

Exception

Remarks

CsvFormatException is unrecoverable, and not handled by the callback.

FieldCount

Gets the number of fields in the record.

public int FieldCount { get; }

Property Value

int

Fields

Returns the CsvFields<T> instance.

public CsvFields<T> Fields { get; }

Property Value

CsvFields<T>

Remarks

The instance is only valid until the handler returns, and should not be stored for further use.

Header

Returns the header record, or empty if no headers in CSV.

public ImmutableArray<string> Header { get; }

Property Value

ImmutableArray<string>

Line

1-based line number.

public int Line { get; }

Property Value

int

Options

Options instance.

public CsvOptions<T> Options { get; }

Property Value

CsvOptions<T>

Position

0-based character position in the data, measured from the start of the record.

public long Position { get; }

Property Value

long

Record

The current CSV record (unescaped/untrimmed).

public ReadOnlySpan<T> Record { get; }

Property Value

ReadOnlySpan<T>

Methods

GetField(int, bool)

Returns the value of a field.

public ReadOnlySpan<T> GetField(int index, bool raw = false)

Parameters

index int

0-based field index

raw bool

Don't unescape the value

Returns

ReadOnlySpan<T>

Value of the field