Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dictionary<string, List<SomeType>> GetKeyPairValues()
- {
- // get nested dictionary from this.myDict
- }
- Dictionary<string, List<SomeType>> GetKeyPairValues()
- {
- return dic.Values.SelectMany(d => d)
- .GroupBy(p => p.Key)
- .ToDictionary(g => g.Key,
- g => g.SelectMany(pair => pair.Value)
- .ToList());
- }
- return myDict.Values.ToDictionary(x => x.Keys, x => x.Values);
- Dictionary<string, List<SomeType>> GetKeyPairValues()
- {
- foreach (var pair in dict)
- {
- yield return pair.Value;
- }
- }
- var dictionary = new Dictionary<string, Dictionary<string, List<int>>>();//initialize your source dictionary
- var mergedDictionary = dictionary.SelectMany(d => d.Value).ToDictionary(k=>k.Key, k=>k.Value);
- IDictionary<string, Dictionary<string, List<SomeType>>> dict = new Dictionary<string, Dictionary<string, List<SomeType>>>();
- ICollection<Dictionary<string, List<SomeType>>> = dict.Values;
Add Comment
Please, Sign In to add comment