csvHelper to list of objects

I am trying to get data from a CSV file and put it into a list of objects, this is what I get so far:

 using (var reader = new StreamReader(path))            
            using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture)) {                
                var records = csv.GetRecords<cities>();
                cities_list = records.ToList();
            }

            Console.WriteLine(cities_list[0]);


Read more here: https://stackoverflow.com/questions/65077662/csvhelper-to-list-of-objects

Content Attribution

This content was originally published by Caio Goncalves at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: