How can I use LINQ to find the Intersect between two properties of the same collection?
Posted
by aponzani
on Stack Overflow
See other posts from Stack Overflow
or by aponzani
Published on 2010-04-28T21:27:28Z
Indexed on
2010/04/28
21:47 UTC
Read the original article
Hit count: 243
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
© Stack Overflow or respective owner