given the following data source:
public struct Strc
{
public decimal A;
public decimal B;
// more stuff
}
public class CLASS
{
public List<Strc> listStrc = new List<Strc>();
// other stuff
}
Dictionary<string, CLASS> dict = new Dictionary<string, CLASS>();
I need to collect all the Strc.B in the dictionary, provided Strc.A is e.g > 3.
I get the result doing the following:
List<decimal> results = (
from v in dizS.Values
from ls in v.listStr
where ls.A > 3
select ls.B
).ToList();
I was also trying to write it using lambdas, but I fail miserably...
var res = dict.Values.Where(x => x.listStrc.Any(z => z.A > 3))
this is as far as I could get, but I do not manage to select then the .B data... What do I do wrong? (given I did anything right in the first place :D) Thanks for your time.