DelimitedDuplicateHeaderBehavior Enum
Definition
- Assembly
- Bodu.Text.Delimited.dll
- Package
- Bodu.Text.Delimited 1.3.0
Specifies how a delimited reader resolves a header row that contains the same column name more than once.
public enum DelimitedDuplicateHeaderBehavior
- Extension Methods
Fields
Throw = 0A duplicate header name throws DelimitedFormatException.
TakeFirst = 1The first column with a duplicated name keeps it, and the later columns with it are reported under an empty name.
TakeLast = 2The last column with a duplicated name keeps it, and the earlier columns with it are reported under an empty name.
Remarks
Under TakeFirst and TakeLast one column with a duplicated name keeps it, and the reader reports every other column with the name under an empty name, both as the record's property names and in Headers. A lookup by name therefore finds the winning column, through GetProperty(string) and in the records of Parse(ReadOnlySpan<byte>, DelimitedReaderOptions) alike. A DelimitedObject holds one field per name, so the columns reported under an empty name share one field there, which keeps the last of their values.
The policy is a reader option, so it applies to Utf8DelimitedReader and to the document models parsed through it. DelimitedSerializer takes no reader policies: in header mode it always throws DelimitedFormatException for a duplicate header name.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |