我想:如何转换`词典<字符串,字典<字符串,列表<MyCustomClass >>>``到词典<字符串,列表<MyCustomClass >>`
endResult = tempResult.Where(x => x.Key.Equals(nameOfMyList))
.SelectMany(wert => wert as List<MyCustomClass>)
.Cast<Dictionary<string, List<MyCustomClass>>>().ToDictionary(); //error "can not convert type"
endResult
是Dictionary<string, List<MyCustomClass>>
。
tempResult
是Dictionary<string, Dictionary<string, List<MyCustomClass>>>
。
这里有什么问题?
更新:
对不起,我写了endResult
是Dictionary<string, List<MyCustomClass>>
,而不是Dictionary<string, Dictionary<string, List<MyCustomClass>>>
(更新它)
其实我想从Dictionary<string, Dictionary<string, List<MyCustomClass>>>
提取Dictionary<string, List<MyCustomClass>>
,转换种类,投
大概只是一个错字,但根据你的话题,我认为你的“endresult”类型应该是Dictionary>。 –
已更新我的帖子 – kkkk00999