【发布时间】:2012-08-07 09:08:32
【问题描述】:
我尝试使用 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>'
如何解决这个问题?
【问题讨论】:
标签: linq dictionary datareader