JoshClose / CsvHelper

Library to help reading and writing CSV files
http://joshclose.github.io/CsvHelper/
Other
4.63k stars 1.05k forks source link

Fix 2153 TypeConverterFactory not used #2229

Closed StefanBertels closed 5 months ago

StefanBertels commented 5 months ago

See https://github.com/JoshClose/CsvHelper/issues/2153

Notes: I added a new abstract TypeConverterGeneric class to make it easier to create generic type converters. This is not necessary to fix the issue, but makes it a easier to write generic type converter factories (as can be seen in test).

Please have a look at System.Text.Json.Serialization.JsonConverter (and JsonConverterFactory) which has this and is a quite useful API. I recommend to rename TypeConverterGeneric<T> to TypeConverter<T> to make it consistent (see again JsonConverter) but this name is already taken without <T> for something different. I will add another commit to solve this but of course this is a (minor) breaking change as current TypeConverter is public (but probably not used by anyone). Please feel free to edit/cherry pick.

Let me know if there is anything I can do getting this merged.