using (var sr = new StreamReader("myfile.csv"))
{
var reader = new CsvReader(sr);
List<dynamic> csvRecords = reader.GetRecords<dynamic>().ToList();
//this works
foreach (var row in csvRecords)
{
foreach (var item in row)
{
var z = item.Value;
}
}
//this should work, error message below
foreach (var row in csvRecords)
{
var z = row[0].Value;
}
}
ERROR
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: Cannot apply indexing with [] to an expression of type 'System.Dynamic.ExpandoObject