CsvDeserializationErrorContext Class
Describes an error of CsvSerializer while it converts records to objects, passed to CsvSerializerOptions.DeserializationErrorHandler.
public sealed class CsvDeserializationErrorContextProperties
| Name | Description |
|---|---|
| ColumnIndex | Gets the 0-based index of the column, or null when the error is not about one column. |
| ColumnName | Gets the name of the column from the header row, or null when the data has no header row or the error is not about one column. |
| Exception | Gets the exception that the serializer throws for this error when the handler returns CsvDeserializationErrorAction.Throw, or when there is no handler. |
| Kind | Gets the kind of error. |
| LineNumber | Gets the 1-based line number where the record starts. |
| MemberName | Gets the column name of the member, as the type defines it, or null when the column has no member. |
| Position | Gets the 0-based position, in characters or in bytes from the start of the data, where the record starts. |
| RawValue | Gets the value that cannot be converted, for CsvDeserializationErrorKind.ConversionFailed; otherwise, null. |
| RowIndex | Gets the 0-based index of the record, not counting the header row. |
| Type | Gets the type of the objects being read. |
ColumnIndex
CsvDeserializationErrorContext.csColumnName
CsvDeserializationErrorContext.csException
CsvDeserializationErrorContext.csGets the exception that the serializer throws for this error when the handler returns CsvDeserializationErrorAction.Throw, or when there is no handler.
public CsvException Exception { get; }Property value
LineNumber
CsvDeserializationErrorContext.csMemberName
CsvDeserializationErrorContext.csGets the column name of the member, as the type defines it, or null when the column has no member.
public string? MemberName { get; }Property value
Remarks
When CsvSerializerOptions.PropertyNameCaseInsensitive is true, the header row can write it differently: CsvDeserializationErrorContext.ColumnName is the name as written in the header row.
Gets the value that cannot be converted, for CsvDeserializationErrorKind.ConversionFailed; otherwise, null.
public string? RawValue { get; }