I have two List<object>. A field in the objects is party_id.
Is there a way, using LINQ, to get a list back of only the common party_ids? So, maybe join the lists on Party ID and then return the ones with matches?
In SQL, I guess I'd do:
SELECT DISTINCT party_id FROM table1
INNER JOIN table2 on table1.party_id = table2.party_id
Thanks.
You can try this:
table1.Select(r => r.party_id).Intersect(table2.Select(r => r.party_id))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With