c# - How to convert `Dictionary<string, Dictionary<string, List<MyCustomClass>>>` to `Dictionary<string, List<MyCustomClass>> ` -
i tried:
endresult = tempresult.where(x => x.key.equals(nameofmylist)) .selectmany(wert => wert 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>>>
.
what's wrong here?
updated:
sorry, wrote endresult
dictionary<string, list<mycustomclass>>
and not dictionary<string, dictionary<string, list<mycustomclass>>>
(updated it)
actually want extract dictionary<string, list<mycustomclass>>
fromdictionary<string, dictionary<string, list<mycustomclass>>>
, kind of conversion, cast
i think don't understand dictionaries. check example:
var foo = new dictionary<string, dictionary<string, list<mycustomclass>>>(); ... // add content foo. ... string nameofmylist = ""; // exists key in foo. dictionary<string, list<mycustomclass>> result = foo[nameofmylist];
Comments
Post a Comment