I tried to use LINQ to convert one row to Dictionary (fieldName -> fieldValue)
return Enumerable.Range(0, reader.FieldCount)
.ToDictionary<string, object>(reader.GetName, reader.GetValue);
but I received error message:
Instance argument: cannot convert from 'System.Collections.Generic.IEnumerable<int>'
to 'System.Collections.Generic.IEnumerable<string>'
How to correct this?
return Enumerable.Range(0, reader.FieldCount)
.ToDictionary(
i => reader.GetName(i),
i => reader.GetValue(i));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With