How can I use LINQ to find the Intersect between two properties of the same collection?
- by aponzani
Given an IList<Foo> with a data set that looks like this:
ID CHILD PARENT TYPE
1 102 101 UPSELL
1 103 101 UPSELL
2 102 101 BONUS
2 104 103 BONUS
3 102 101 BONUS
4 102 101 PRODUCT
4 104 102 PRODUCT
How can I use LINQ to find the intersection of Parent and Child values withing each ID?
Desired output is
ID CHILD PARENT TYPE
4 102 101 PRODUCT