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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -