Utf8CsvRecord Struct
- Obsolete: Types with embedded references are not supported in this version of your compiler.
A record read by Utf8CsvReader. 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 Utf8CsvRecordProperties
| Name | Description |
|---|---|
| ColumnCount | Gets the number of columns of the record. An empty line has no column. |
| LineNumber | Gets the 1-based line number where the record starts. |
| RawUtf8Span | Gets the UTF-8 bytes of the record, as they are in the data, without its line terminator. |
| RowIndex | Gets the 0-based index of the record. The header row and the comment lines are not counted. |
ColumnCount
Utf8CsvRecord.csLineNumber
Utf8CsvRecord.csRawUtf8Span
Utf8CsvRecord.csGets the UTF-8 bytes of the record, as they are in the data, without its line terminator.
public ReadOnlySpan<byte> RawUtf8Span { get; }Property value
RowIndex
Utf8CsvRecord.csIndexers
| Name | Description |
|---|---|
| this[Index] | Gets the value of a column. |
| this[int] | Gets the value of a column. |
| this[string] | Gets the value of the column with the specified name in the header row. |
Item overloads
this[Index]
Utf8CsvRecord.csGets the value of a column.
public Utf8CsvField this[Index index] { get; }Parameters
indexIndex- The index of the column, which can be from the end, such as
^1for the last column.
Property value
Exceptions
ArgumentOutOfRangeException- The record has no column at
index.
this[int]
Utf8CsvRecord.csGets the value of a column.
public Utf8CsvField this[int index] { get; }Parameters
indexint- The 0-based index of the column.
Property value
Exceptions
ArgumentOutOfRangeException- The record has no column at
index.
this[string]
Utf8CsvRecord.csGets the value of the column with the specified name in the header row.
public Utf8CsvField this[string columnName] { get; }Parameters
columnNamestring- The name of the column.
Property value
Exceptions
InvalidOperationException- The reader has no header row.
KeyNotFoundException- The header row has no column with this name.
ArgumentOutOfRangeException- The record is shorter than the header row and has no value for this column.
Methods
| Name | Description |
|---|---|
| ToString() | Gets the text of the record, as it is in the data. |
| ToStringArray() | Gets the values of all the columns as strings. |
| TryGetField(string, Utf8CsvField) | Gets the value of the column with the specified name in the header row. |
ToString()
Utf8CsvRecord.csToStringArray()
Utf8CsvRecord.csGets the values of all the columns as strings.
public string[] ToStringArray()Returns
string[] The values of the record.
TryGetField(string, Utf8CsvField)
Utf8CsvRecord.csGets the value of the column with the specified name in the header row.
public bool TryGetField(string columnName, out Utf8CsvField field)Parameters
columnNamestring- The name of the column.
fieldUtf8CsvField- The value of the column.
Returns
bool true when the header row has a column with this name and the record has a value for it; otherwise, false.
Exceptions
InvalidOperationException- The reader has no header row.