Utf8CsvField Struct
- Obsolete: Types with embedded references are not supported in this version of your compiler.
The value of a column of a Utf8CsvRecord. 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 Utf8CsvFieldProperties
| Name | Description |
|---|---|
| ColumnIndex | Gets the 0-based index of the column. |
| IsEmpty | Gets a value indicating whether the value is empty. |
| IsQuoted | Gets a value indicating whether the value is quoted in the data. |
| RawUtf8Span | Gets the UTF-8 bytes of the value, as they are in the data. |
| Utf8Span | Gets the UTF-8 bytes of the value, without its quotes, with escaped quotes unescaped and trimmed as CsvReaderOptions.Trim says. |
ColumnIndex
Utf8CsvField.csIsEmpty
Utf8CsvField.csIsQuoted
Utf8CsvField.csRawUtf8Span
Utf8CsvField.csGets the UTF-8 bytes of the value, as they are in the data.
public ReadOnlySpan<byte> RawUtf8Span { get; }Property value
Utf8Span
Utf8CsvField.csGets the UTF-8 bytes of the value, without its quotes, with escaped quotes unescaped and trimmed as CsvReaderOptions.Trim says.
public ReadOnlySpan<byte> Utf8Span { get; }Property value
Methods
| Name | Description |
|---|---|
| Parse<T>() | Parses the UTF-8 bytes of the value with CsvReaderOptions.FormatProvider. |
| ParseEnum<TEnum>(bool) | Parses the value as the name or the number of a member of an enumeration. |
| ParseUtf16<T>() | Decodes the value to UTF-16 and parses it with CsvReaderOptions.FormatProvider. |
| ToString() | Gets the value as a string. Invalid UTF-8 sequences are replaced with U+FFFD. |
| TryParse<T>(T) | Tries to parse the UTF-8 bytes of the value with CsvReaderOptions.FormatProvider. |
| TryParseUtf16<T>(T) | Decodes the value to UTF-16 and tries to parse it with CsvReaderOptions.FormatProvider. |
Parse<T>()
Utf8CsvField.csParses the UTF-8 bytes of the value with CsvReaderOptions.FormatProvider.
public T Parse<T>() where T : IUtf8SpanParsable<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.
Remarks
Use Utf8CsvField.ParseUtf16 for the types that cannot parse UTF-8, such as DateTime.
ParseEnum<TEnum>(bool)
Utf8CsvField.csParses the value as the name or the number of a member of an enumeration.
Type parameters
TEnum- The type of the enumeration.
Parameters
ignoreCasebooltrueto ignore the case of the name.
Returns
TEnum The parsed value.
Exceptions
CsvException- The value is not valid for
TEnum.
ParseUtf16<T>()
Utf8CsvField.csDecodes the value to UTF-16 and parses it with CsvReaderOptions.FormatProvider.
public T ParseUtf16<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.
ToString()
Utf8CsvField.csTryParse<T>(T)
Utf8CsvField.csTries to parse the UTF-8 bytes of the value with CsvReaderOptions.FormatProvider.
public bool TryParse<T>(out T result) where T : IUtf8SpanParsable<T>Type parameters
T- The type to parse the value to.
Parameters
resultT- The parsed value.
Returns
bool true when the value is valid for T; otherwise, false.
TryParseUtf16<T>(T)
Utf8CsvField.csDecodes the value to UTF-16 and tries to parse it with CsvReaderOptions.FormatProvider.
public bool TryParseUtf16<T>(out T result) where T : ISpanParsable<T>Type parameters
T- The type to parse the value to.
Parameters
resultT- The parsed value.
Returns
bool true when the value is valid for T; otherwise, false.