我尝试使用 LINQ 将一行转换为 Dictionary (fieldName -> fieldValue)
return Enumerable.Range(0, reader.FieldCount)
.ToDictionary<string, object>(reader.GetName, reader.GetValue);
但我收到错误消息:
实例参数:无法转换'System.Collections.Generic.IEnumerable<int>'
为'System.Collections.Generic.IEnumerable<string>'
如何纠正这个?