Table of Contents

Struct CsvFieldsRef<T>

Namespace
FlameCsv.Reading
Assembly
FlameCsv.Core.dll

Internal implementation detail. This type should probably not be used directly. Using an unitialized instance leads to undefined behavior.

[EditorBrowsable(EditorBrowsableState.Never)]
public readonly ref struct CsvFieldsRef<T> : ICsvFields<T> where T : unmanaged, IBinaryInteger<T>

Type Parameters

T
Implements

Properties

FieldCount

Gets the number of fields in the record.

public int FieldCount { get; }

Property Value

int

this[int]

Returns the field at index.

public ReadOnlySpan<T> this[int index] { get; }

Parameters

index int

Zero-based index of the field to get.

Property Value

ReadOnlySpan<T>

Remarks

The span is only valid until another field or the next record is read.

Exceptions

ArgumentOutOfRangeException

Thrown if index is less than 0 or greater than or equal to FieldCount

Record

Data of the raw record, not including possible trailing newline.

public ReadOnlySpan<T> Record { get; }

Property Value

ReadOnlySpan<T>

Methods

GetRawSpan(int)

Returns the raw unescaped span of the field at the specified index.

public ReadOnlySpan<T> GetRawSpan(int index)

Parameters

index int

0-based field index

Returns

ReadOnlySpan<T>

Exceptions

ArgumentOutOfRangeException

Thrown if index is less than 0 or greater than or equal to FieldCount

See Also

GetRecordLength(bool)

Returns length of the raw record.

public int GetRecordLength(bool includeTrailingNewline = false)

Parameters

includeTrailingNewline bool

Returns

int

GetSpan(int, Span<T>)

Returns the field span at the specified index.

public ReadOnlySpan<T> GetSpan(int index, Span<T> unescapeBuffer)

Parameters

index int

0-based field index

unescapeBuffer Span<T>

Buffer to unescape the value to if needed

Returns

ReadOnlySpan<T>

Remarks

The field is escaped to unescapeBuffer if needed.

Exceptions

ArgumentOutOfRangeException

Thrown if index is less than 0 or greater than or equal to FieldCount

ArgumentException

Thrown if unescapeBuffer is not large enough to hold the unescaped field.

See Also

ToString()

Returns a diagnostic string representation of the current instance.

public override string ToString()

Returns

string

Remarks

See Record to get the actual record span.