Given a list of parent objects, each of which has a list of child objects, I want to find a child object that matches a specific identifier.
public class Parent { public int ID { get; set; } public List<Child> Children { get; set; } } public class Child { public int ID { get; set; } }
Now I want the Child object to have a specific ID:
List<Parent> parents = GetParents(); Child childWithId17 = ???
How to do it with Linq?
source share