Table of Contents

Class CsvBindingCollection<TValue>

Namespace
FlameCsv.Binding
Assembly
FlameCsv.Core.dll

Represents a validated collection of CSV fields bound to properties, fields, or constructor parameters.

[DebuggerDisplay("CsvBindingCollection<{typeof(TValue).Name,nq}>[{_allBindings.Count}]")]
public sealed class CsvBindingCollection<TValue> : IEnumerable<CsvBinding<TValue>>, IEnumerable

Type Parameters

TValue

Type represented by the CSV

Inheritance
object
CsvBindingCollection<TValue>
Implements

Constructors

CsvBindingCollection(IEnumerable<CsvBinding<TValue>>, bool, bool)

Initializes a new binding collection.

public CsvBindingCollection(IEnumerable<CsvBinding<TValue>> typeBindings, bool write, bool ignoreDuplicates)

Parameters

typeBindings IEnumerable<CsvBinding<TValue>>

Bindings to initialize the collection with

write bool

The bindings are for writing and not reading CSV

ignoreDuplicates bool

Whether bindings targeting the same member/parameter should be ignored instead of throwing an exception

Exceptions

CsvBindingException

Bindings are invalid

Properties

Bindings

All bindings, sorted by index. Guaranteed to be valid.

public ReadOnlySpan<CsvBinding<TValue>> Bindings { get; }

Property Value

ReadOnlySpan<CsvBinding<TValue>>

Constructor

Returns the constructor used by the bindings.

public ConstructorInfo Constructor { get; }

Property Value

ConstructorInfo

Exceptions

InvalidOperationException

There are no constructor bindings

See Also

ForReading

Returns true if the bindings are for reading CSV.

public bool ForReading { get; }

Property Value

bool

ForWriting

Returns true if the bindings are for writing CSV.

public bool ForWriting { get; }

Property Value

bool

HasConstructorParameters

Returns true if the bindings will use a specific constructor.

public bool HasConstructorParameters { get; }

Property Value

bool

Remarks

This is always false if ForWriting is true.

HasMemberInitializers

Return true is FlameCsv.Binding.CsvBindingCollection<TValue>.MemberBindings is not empty.

public bool HasMemberInitializers { get; }

Property Value

bool

Remarks

This is always true if ForWriting is true.