CsvException Class

The exception thrown when CSV data is invalid or cannot be converted.

public sealed class CsvException : Exception
Inheritance
Exception CsvException

Constructors

NameDescription
CsvException()Initializes a new instance of the CsvException class.
CsvException(string?)Initializes a new instance of the CsvException class with a message.
CsvException(string?, Exception?)Initializes a new instance of the CsvException class with a message and the exception that caused it.

CsvException overloads

CsvException()

CsvException.cs

Initializes a new instance of the CsvException class.

public CsvException()

CsvException(string?)

CsvException.cs

Initializes a new instance of the CsvException class with a message.

public CsvException(string? message)
Parameters
message string?
The message that describes the error.

CsvException(string?, Exception?)

CsvException.cs

Initializes a new instance of the CsvException class with a message and the exception that caused it.

public CsvException(string? message, Exception? innerException)
Parameters
message string?
The message that describes the error.
innerException Exception?
The exception that caused this exception.

Properties

NameDescription
ColumnIndexGets the 0-based index of the column that caused the error, if known.
ColumnNameGets the name of the column that caused the error, if known.
LineNumberGets the 1-based line number where the record that caused the error starts, if known.
PositionGets the 0-based position, in characters or in bytes from the start of the data, of the record that caused the error, if known.
RowIndexGets the 0-based index of the record where the error occurred, not counting the header row, if known.

ColumnIndex

CsvException.cs

Gets the 0-based index of the column that caused the error, if known.

public int? ColumnIndex { get; }

Property value

int?

ColumnName

CsvException.cs

Gets the name of the column that caused the error, if known.

public string? ColumnName { get; }

Property value

string?

LineNumber

CsvException.cs

Gets the 1-based line number where the record that caused the error starts, if known.

public long? LineNumber { get; }

Property value

long?

Gets the 0-based position, in characters or in bytes from the start of the data, of the record that caused the error, if known.

public long? Position { get; }

Property value

long?

Gets the 0-based index of the record where the error occurred, not counting the header row, if known.

public long? RowIndex { get; }

Property value

long?