I have LINQ Query which return result in below format
-- Parent1 ----Childs ------key - aa ------value - new ----Childs ------key - bb ------value - old -- Parent2 ----Childs ------key - cc ------value - test ----Childs ------key - dd ------value - tesst
I want to fetch the child value in one line using Linq. currently I can get the value but in two line of code which i don’t like it
var firstPoint = SeriesList.Select(i => i.Childs.Where(j => j.key == "aa"))
.FirstOrDefault();
decimal index = firstPoint.Select(d => d.Value)
.FirstOrDefault();
1 Answer