CsvHelper: Replace missing Csv field with another expression?
问题 When a field is missing in the CSV file, an exception is thrown. I'd rather map another value (such as empty string) when a field is missing. Map(dest => dest.PatientID).Name("Patient ID"); CsvHelper.CsvMissingFieldException: 'Fields 'Patient ID' do not exist in the CSV file.' If the configuration setting IgnoreReadingExceptions is used, no records are read into the results. var csv = new CsvReader(sr); csv.Configuration.RegisterClassMap<TMap>(); csv.Configuration.IgnoreReadingExceptions =