CsvHelper icon indicating copy to clipboard operation
CsvHelper copied to clipboard

`CsvWriter.Context.Configuration.HasHeaderRecord = false` does not work as expected

Open space-alien opened this issue 2 years ago • 2 comments

In previous versions, csv.Configuration.HasHeaderRecord = false; would prevent a CsvWriter from printing a header.

In the current version, csv.Context.Configuration.HasHeaderRecord = false; no longer prevents a header from being printed.

If the configuration is supplied at construction time, e.g. new CsvWriter(writer, new CsvConfiguration(ci) { HasHeaderRecord = false }); then the header is not printed, as expected.

space-alien avatar Sep 06 '22 11:09 space-alien

Could I work on it?

ahlavorato avatar Oct 07 '22 19:10 ahlavorato

This is expected. All values from a configuration are copied locally in the constructor. csv.Configuration.HasHeaderRecord is read only. The configuration on the context is there if you need to access the original config for some reason, but changes to it don't get applied anywhere.

JoshClose avatar Oct 07 '22 19:10 JoshClose