using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
Dictionary<string, string> dict_inner = new Dictionary<string, string>();
dict_inner.Add("inner1", "inner_val1");
dict_inner.Add("inner2", "inner_val2");
Dictionary<string, string> dict_inner2 = new Dictionary<string, string>();
dict_inner.Add("inner11", "inner_val1");
dict_inner.Add("inner21", "inner_val2");
Dictionary<string, Dictionary<string, string>> dict_outer = new Dictionary<string, Dictionary<string, string>>();
dict_outer.Add("outer1", dict_inner);
dict_outer.Add("outer2", dict_inner2);
var result2 = dict_outer.SelectMany(x => x.Value).ToDictionary(x => x.Key, x => x.Value);
foreach(var res2 in result2)
Console.WriteLine(res2.Key);
Console.WriteLine(res2.Value);
Console.WriteLine("-------------");
var intendedResult = dict_outer.Where(k => k.Value.Any(ik => ik.Key == "inner1")).ToDictionary(d => d.Key, d => d.Value);
foreach(var res in intendedResult)
Console.WriteLine(res.Key);
var i = res.Value.ToDictionary(d => d.Key, d => d.Value);
Console.WriteLine(res2.Key);
Console.WriteLine(res2.Value);