【发布时间】:2019-01-29 11:30:49
【问题描述】:
如何将List<Dictionary<string, byte[]> 对象添加到Dictionary<string, byte[]>
public static async void PostUploadtoCloud( List<Dictionary<string, byte[]>> _commonFileCollection)
{
Dictionary<string, Byte[]> _dickeyValuePairs = new Dictionary<string, byte[]>();
foreach (var item in _commonFileCollection)
{
_dickeyValuePairs.add(item.key,item.value); // i want this but I am getting
//_dickeyValuePairs.Add(item.Keys, item.Values); so I am not able to add it dictionary local variable _dickeyValuePairs
}
}
在 foreach 循环中,我得到了 item.KEYS 和 item.VALUES,所以我该如何添加它
_dickeyValuePairs
【问题讨论】:
-
当然你需要一个嵌套的
foreach-item在你的当前循环中是一个Dictionary<string, byte[]>。 -
_commonFileCollection中的每个item本身似乎都是一个字典。如果您想使用该字典 within 的项目,看起来您需要一个内部循环。
标签: c# generics generic-collections