Is there an easy way to convert all the columns of the current row of a SqlDataReader to a dictionary?
using (SqlDataReader opReader = command.ExecuteReader())
{
// Convert the current row to a dictionary
}
Thanks
You can use LINQ:
return Enumerable.Range(0, reader.FieldCount)
.ToDictionary(reader.GetName, reader.GetValue);