CsvHeader Class

The names of the columns, read from the header row.

public sealed class CsvHeader

Properties

NameDescription
ColumnCountGets the number of columns of the header row.
ColumnNamesGets the names of the columns, in order.

ColumnCount

CsvHeader.cs

Gets the number of columns of the header row.

public int ColumnCount { get; }

Property value

int

ColumnNames

CsvHeader.cs

Gets the names of the columns, in order.

public IReadOnlyList<string> ColumnNames { get; }

Property value

IReadOnlyList<string>

Methods

NameDescription
IndexOf(string)Gets the 0-based index of the column with the specified name.
ToString()Returns a string that represents the current object.
TryGetIndex(string, int)Gets the 0-based index of the column with the specified name.

IndexOf(string)

CsvHeader.cs

Gets the 0-based index of the column with the specified name.

public int IndexOf(string columnName)

Parameters

columnName string
The name of the column.

Returns

int The index of the first column with this name, or -1 when the header has no such column.

ToString()

CsvHeader.cs

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.

TryGetIndex(string, int)

CsvHeader.cs

Gets the 0-based index of the column with the specified name.

public bool TryGetIndex(string columnName, out int index)

Parameters

columnName string
The name of the column.
index int
The index of the first column with this name.

Returns

bool true when the header has a column with this name; otherwise, false.