CsvField Struct

  • Obsolete: Types with embedded references are not supported in this version of your compiler.

The value of a column of a CsvRecord. It is valid until the next record is read.

[Obsolete("Types with embedded references are not supported in this version of your compiler.", true)]
public readonly ref struct CsvField

Properties

NameDescription
ColumnIndexGets the 0-based index of the column.
IsEmptyGets a value indicating whether the value is empty.
IsQuotedGets a value indicating whether the value is quoted in the data.
RawSpanGets the text of the value, as it is in the data.
SpanGets the value, without its quotes, with escaped quotes unescaped and trimmed as CsvReaderOptions.Trim says.

ColumnIndex

CsvField.cs

Gets the 0-based index of the column.

public int ColumnIndex { get; }

Property value

int

Gets a value indicating whether the value is empty.

public bool IsEmpty { get; }

Property value

bool

IsQuoted

CsvField.cs

Gets a value indicating whether the value is quoted in the data.

public bool IsQuoted { get; }

Property value

bool

Gets the text of the value, as it is in the data.

public ReadOnlySpan<char> RawSpan { get; }

Property value

ReadOnlySpan<char>

Gets the value, without its quotes, with escaped quotes unescaped and trimmed as CsvReaderOptions.Trim says.

public ReadOnlySpan<char> Span { get; }

Property value

ReadOnlySpan<char>

Methods

NameDescription
Parse<T>()Parses the value with CsvReaderOptions.FormatProvider.
ParseEnum<TEnum>(bool)Parses the value as the name or the number of a member of an enumeration.
ToString()Gets the value as a string.
TryParse<T>(T)Tries to parse the value with CsvReaderOptions.FormatProvider.

Parse<T>()

CsvField.cs

Parses the value with CsvReaderOptions.FormatProvider.

public T Parse<T>() where T : ISpanParsable<T>

Type parameters

T
The type to parse the value to.

Returns

T The parsed value.

Exceptions

CsvException
The value is not valid for T.

ParseEnum<TEnum>(bool)

CsvField.cs

Parses the value as the name or the number of a member of an enumeration.

public TEnum ParseEnum<TEnum>(bool ignoreCase = true) where TEnum : struct, Enum

Type parameters

TEnum
The type of the enumeration.

Parameters

ignoreCase bool
true to ignore the case of the name.

Returns

TEnum The parsed value.

Exceptions

CsvException
The value is not valid for TEnum.

ToString()

CsvField.cs

Gets the value as a string.

public override string ToString()

Returns

string The value.

TryParse<T>(T)

CsvField.cs

Tries to parse the value with CsvReaderOptions.FormatProvider.

public bool TryParse<T>(out T result) where T : ISpanParsable<T>

Type parameters

T
The type to parse the value to.

Parameters

result T
The parsed value.

Returns

bool true when the value is valid for T; otherwise, false.