csvhelper

Generic types in RegisterClassMap with parameters

非 Y 不嫁゛ 提交于 2020-12-15 05:55:28
问题 We want a generic approach for using CsvHelper. Depending the situation, the format of the CSV file is different. When the external system has all the required info more columns are present. I need to determine if the name of column is present in the CSV file (atm this is done in ResponseMap). So we have an interface List<T> ConvertTo<T, TMap>(string file, Dictionary<string, string> headers) where T : class where TMap : ClassMap<T>; I'm calling it like this. _csvRepository.ConvertTo