public sealed class CsvRecordMember
Namespace
CsvHelper
Assembly
CsvHelper.dll
Builds
net10.0 netstandard2.1 netstandard2.0 net47

Constructors

public CsvRecordMember(string name, Type type, CsvRecordMemberKind kind, IReadOnlyList<string> columnNames, int columnIndex, bool optional, bool isConstructorParameter)

Describes a member. Code generated for CsvRecordAttribute types creates these.

Parameters

namestring
The name of the property or field, or of the constructor parameter when it sets neither.
typeType
The type of the member.
kindCsvRecordMemberKind
How the member gets its value.
columnNamesIReadOnlyList<string>
The header names it reads: its column's name and alternate names, in the order they are tried, or a collection's names; empty for a nested record, a constant, and a collection read by index.
columnIndexint
The 0-based index of its column (the first column of a collection), or -1 when it is found by name or has none.
optionalbool
Whether its columns may be missing from the header.
isConstructorParameterbool
Whether a constructor parameter sets it.

Exceptions

ArgumentNullException
name, type or columnNames is null.

View source

Properties

ColumnIndex

Added in v34.0.0
public int ColumnIndex { get; }

The 0-based index of its column (the first column of a collection), or -1 when it is found by name or has none.

Property value

int

View source

ColumnNames

Added in v34.0.0
public IReadOnlyList<string> ColumnNames { get; }

The header names it reads: its column's name and alternate names, in the order they are tried, or a collection's names; empty for a nested record, a constant, and a collection read by index.

Property value

View source

Name

Added in v34.0.0
public string Name { get; }

The name of the property or field, or of the constructor parameter when it sets neither.

Property value

string

View source

Optional

Added in v34.0.0
public bool Optional { get; }

Whether its columns may be missing from the header.

Property value

bool

View source

Methods

ToString()

Added in v34.0.0
public override string ToString()

The name of the member, its kind and its columns, for debugging.

Returns

string
Such as Price (Column 'Unit Price').

View source