I’ve a dictionary member of type Dictionary<string, Dictionary<string, List<SomeType>>>. What I want is to get nested dictionary from this i.e. Dictionary<string, List<SomeType>>. I thought I’d get this using myDict.Values, but that’s actually returning ValueCollection and not the nested-dictionary itself.
Now I’m trying to get this done using ValueCollection.ToDictionary function, but please share if you’ve already done something similar.
Update
I want to return nested-dictionary
Dictionary<string, List<SomeType>> GetKeyPairValues()
{
// get nested dictionary from this.myDict
}
You need to use
GroupByto group byKeythen merge all list with the same key: