fixed the issue. Will look into that further I want to get different of n numbers of dictionaries using a lambda expression: , You need some Linq methods:
var result = d.SelectMany(d => d.Value).GroupBy(c => c.Key)
.Where(c => c.Count() == 1).ToDictionary(t => t.Key, t => t.Select(c => c.Value)
.FirstOrDefault()).ToList();
hope this fix your issue Sure. You didn't specify a language so I hope that C# is okay (I'm not fluent in VB.NET but I can help you if you need help translating):
var query = TerminalList.SelectMany(kvp => kvp.Value.TableCRCs.Values)
.GroupBy(info => new { info.TableID, info.CRC });
foreach (var result in query) {
Console.WriteLine(
String.Format(
"{0}|{1:x}",
result.Key.TableID,
result.Key.CRC
)
);
}
var t = new TData(); // your TData
var aa = t.data.SelectMany(x =>
x.Value.innerData.Select(y => new
{
url = x.Key,
disp = x.Value.disp,
date = y.Key,
count = y.Value.count,
rank = y.Value.rank,
}));
Using nested dictionaries and populate them with a linq query
it fixes the issue In this particular case there is no need to build dynamic expression predicate. The && can be achieved by chaining multiple Where, and || by putting the values into IEnumerable and using Enumerable.Contains. For single name / values filter it would be something like this:
var name = "anId".ToLower();
var values = new List<string> { "10", "20" }.Select(v => v.ToLower());
query = query.Where(p => p.ParentField.Any(
pf => pf.Field.Name == name && values.Contains(pf.Value.ToLower())));
var filters = new Dictionary<string, List<string>>
{
{ "anId", new List<string> { "10", "20" } },
{ "anotherId", new List<string> { "50", "60" } },
};
foreach (var entry in filters)
{
var name = entry.Key.ToLower();
var values = entry.Value.Select(v => v.ToLower());
query = query.Where(p => p.ParentField.Any(
pf => pf.Field.Name == name && values.Contains(pf.Value.ToLower())));
}