c# - 将 IEnumerable<Dictionary<int, string>> 转换为 List<Dictionary<int, string>>

标签 c# list ienumerable

var a = GetIEnumerableDictionary();

aIEnumerable<Dictionary<int, string>> . 如何将 a 转换为 List<Dictionary<int, string>>

最佳答案

a.ToList()应该可以解决问题。

ToList()扩展方法存在于 System.Linq 中命名空间。如果 Linq 不可用,List<T>构造函数采用 IEnumerable<T>作为参数,因为 Jalal 已在此页面上回答过。

关于c# - 将 IEnumerable<Dictionary<int, string>> 转换为 List<Dictionary<int, string>>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7104317/

相关文章:

c# - 带表格的通用 CSV 导出

C# int 字节转换

list - 查找串联的参数只是使用提升或注入(inject)的索引查找整个串联

c# - IEnumerable/Enumerable with Double/Int;初学者

c# - 如何通过反射过滤任何属性的集合?

c# - 如何在没有 try/catch block 的情况下记录单元测试中抛出的异常?

c# - 在启动期间验证 ASP.NET Core 选项

c# - session 在 Controller 方法中变为空

python - 将一个张量变换为另一个张量

c++ - 如何在 Qt 中的列表小部件内绘制进度条