I'm using dynamic records since I don't know the format of the file I receive:
https://joshclose.github.io/CsvHelper/examples/reading/get-dynamic-records/
That works very good.
But now I've received a file which has duplicate header names.
This can be solved when using a class map:
https://joshclose.github.io/CsvHelper/examples/configuration/class-maps/mapping-duplicate-names
But is there a way to support duplicate header names with dynamic records?
Maybe an auto incrementing number '_2', '_3' etc. could be appended to the name?
Hi, Can i ask you how to solve this problem? do you have any suggestion?
There is no way to do this currently.
Maybe there could be a configuration function to create the property names. You could then easily configure it however you like.
This has been added and is in version 16.0.0 on NuGet. Here is an example of how to configure it. https://github.com/JoshClose/CsvHelper/blob/1ae7e73689ec36cf1578b138d7c6588fa0b85a08/tests/CsvHelper.Tests/Reading/DynamicTests.cs#L76
Thanks Josh! That's awesome
Most helpful comment
This has been added and is in version 16.0.0 on NuGet. Here is an example of how to configure it. https://github.com/JoshClose/CsvHelper/blob/1ae7e73689ec36cf1578b138d7c6588fa0b85a08/tests/CsvHelper.Tests/Reading/DynamicTests.cs#L76