JoshClose / CsvHelper

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

Inline Type Conversion example docs have wrong code. #2180

Closed HarryDavisgithub closed 6 months ago

HarryDavisgithub commented 11 months ago

Hi, Found a little mistake in the docs. Trying to access GetField on the parameter not the row itself. Map(m => m.Json).Convert(row => JsonConvert.DeserializeObject<Json>(row.GetField("Json")));

Should be something like: Map(m => m.Json).Convert(o=> JsonConvert.DeserializeObject<Json>(o.Row.GetField("Json")));

https://joshclose.github.io/CsvHelper/examples/configuration/class-maps/inline-type-conversion/

Thanks!

JustinAFaulkner commented 11 months ago

I second this change, spent quite a while today trying to figure out why this wasn't working for me despite following the docs!

JoshClose commented 6 months ago

Fixed.