Table of Contents

Struct CsvFieldIdentifier

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Identifier for a CSV field, pointing to a specific field by index, or by header name. Can be implicitly created from an integer or a string.
This type is not comparable to any other field identifier, as it's dependent on the header values.

[DebuggerDisplay("{DebuggerDisplay,nq}")]
public readonly struct CsvFieldIdentifier

Remarks

Field indexes are 0-based, so default(CsvFieldIdentifier) points to the first field.

Constructors

CsvFieldIdentifier(int)

Creates a field identifier pointing to a specific field index.

public CsvFieldIdentifier(int index)

Parameters

index int

CsvFieldIdentifier(string)

Creates a field identifier pointing to a specific field by header name.

public CsvFieldIdentifier(string name)

Parameters

name string

Properties

UnsafeIndex

Returns the raw index value.

[EditorBrowsable(EditorBrowsableState.Never)]
public int UnsafeIndex { get; }

Property Value

int

Remarks

May not represent the actual field if the identifier is created from a string.

UnsafeName

Returns the raw string value.

[EditorBrowsable(EditorBrowsableState.Never)]
public string? UnsafeName { get; }

Property Value

string

Remarks

May be null if the identifier is created from an int.

Methods

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

TryGetIndex(out int, out string?)

Returns true if the identifier points to a field index, false if it points to a field by header name.

public bool TryGetIndex(out int index, out string? name)

Parameters

index int

Field index

name string

Field header name

Returns

bool

Operators

implicit operator CsvFieldIdentifier(int)

Returns a field identifier pointing to a specific field index.

public static implicit operator CsvFieldIdentifier(int index)

Parameters

index int

Returns

CsvFieldIdentifier

implicit operator CsvFieldIdentifier(string)

Returns a field identifier pointing to a specific field by header name.

public static implicit operator CsvFieldIdentifier(string name)

Parameters

name string

Returns

CsvFieldIdentifier