Table of Contents

Class CsvHeader

Namespace
FlameCsv
Assembly
FlameCsv.Core.dll

Read-only CSV header record.

public sealed class CsvHeader
Inheritance
CsvHeader

Constructors

CsvHeader(IEqualityComparer<string>, ReadOnlySpan<string>)

Initializes a new instance of the CsvHeader class.

public CsvHeader(IEqualityComparer<string> comparer, ReadOnlySpan<string> header)

Parameters

comparer IEqualityComparer<string>

Comparer to use

header ReadOnlySpan<string>

Header values

Properties

Count

Returns the number of header values.

public int Count { get; }

Property Value

int

HeaderNames

Returns the header names as an enumerable.

public IEnumerable<string> HeaderNames { get; }

Property Value

IEnumerable<string>
See Also

this[string]

Returns the index of the specified header.

public int this[string key] { get; }

Parameters

key string

Property Value

int

Exceptions

ArgumentException

The header is not found.

Values

Returns the header values.

public ReadOnlySpan<string> Values { get; }

Property Value

ReadOnlySpan<string>

Methods

ContainsKey(string)

Returns true if the specified header is present.

public bool ContainsKey(string key)

Parameters

key string

Header name

Returns

bool

Get<T>(CsvOptions<T>, scoped ReadOnlySpan<T>, scoped Span<char>)

Retrieves a string representation of the given value using the provided options.

public static string Get<T>(CsvOptions<T> options, scoped ReadOnlySpan<T> value, scoped Span<char> buffer) where T : unmanaged, IBinaryInteger<T>

Parameters

options CsvOptions<T>

The CSV options used for conversion.

value ReadOnlySpan<T>

The header field.

buffer Span<char>

A buffer to write the characters to.

Returns

string

A string representation of the value. The header values are pooled if they fit in the buffer using TryGetChars(ReadOnlySpan<T>, Span<char>, out int), and the options-type is not inherited. Otherwise, it is converted to a string using GetAsString(ReadOnlySpan<T>).

Type Parameters

T

TryGetValue(string, out int)

Attempts to return the index of the specified header.

public bool TryGetValue(string key, out int value)

Parameters

key string
value int

Returns

bool