I have three classes with properties (Class:Properties)
Parent: Id, Name, List
Child: Id, Name, List
SubChild: Id, Name, Value
I have a List of Parent. I want to achieve all of those subchild objects which have value (integer) >1 and <200
Edit: For better explaination So if I have List count 5 i.e. Parent1, Parent2, ..., Parent5
Each Parent instance has a list of children. so.. Parent1.Children.Count = 3, Parent2.Children.Count = 3 etc
Each Child object has 10 sub children. So Parent1.Children[0].SubChildren.Count = 10.
Each sub child has a value between 1 to 5000. And All parents have these sub children
I want to get back 5 parents back, with 3 children and only those sub children which meet the value criteria.
I tried to use following query amongst others and it doesn't work:
List<Parent> Parents = ThisParent.Where(
m => m.Child.Where(c => c.SubChild.Where(
t => t.Value > Convert.ToInt32(1)
&&
t.Value < Convert.ToInt32(200))));