Linq嵌套查询获取Dictionary结果
1.已知Item有属性Key & Value,如下,
/// <summary>
/// key,Value,可用于Ini,XML等结构中
/// </summary>
public class Item
{
public string Key { get; set; }
public string Val { get; set; }
}
2.Dictionary包含着Item的集合,如下,
Dictionary<string, List<Item>> TestIni = INIUtil.GetIni(@”\\TestPC\Test.ini”);
///INIUtil 可以参考此文章 http://www.128mn.com/29.html
///先需要通过Item里面其中的一个Value值,筛选符合条件的Dictionary,如下,
var a = TestIni.Where(x => x.Value.Select(y => y.Val).Any(z => z.Contains(“查找的Value值”))).Select(x=>x.Value);
///得到筛选后的结果
foreach (var m in a)
{
///得到List<Item>
Console.Write(m.ToString());
foreach(var n in m){
///得到Item
Console.Write(n.ToString());
}
}
Fantastic website. A lot of useful information here. I'm sending it to a few pals ans also sharing in delicious. And naturally, thank you in your sweat! eefkaeaaaadb
Thanks!
Where To Purchase Generic Ciprofloxacin 0.3 5ml in Albuquerque gkfcdekeakecddfe
Thanks