c# - How do I get the sum of the Counts of nested Lists in a Dictionary without using foreach? -
I want to get the following number of the following objects in the
: list
s
dictionary & lt; Int, list & lt; String & gt; & Gt; DD = new dictionary & lt; Int, list & lt; String & gt; & Gt; () {{1, new list & lt; String & gt; {"Cem"}}, {2, new list & lt; String & gt; {"Cem", "canan"}}, {3, new list & lt; String & gt; {"Canan", "cenk", "cem"}}}; // It only gives an enumerated array Var i = (Select from dd c.Value.Count). Choose (P => P);
I believe this will give you the calculation you want It is efficiently and clearly to walk through the lists under the hood, but to count the total, there is no way to avoid this.
var i = dd.values.Sum (x => x .ount);
Comments
Post a Comment