I have a few list. Their count isn't clear.
For example (for 4 list):
List1 List2 List3 List4
----- ----- ----- -----
1 2 3 4
2 4 8 3
3 8 4 5
4 11 6 1
5 3 7 7
6 9 11 9
I want to find the items that are common. It can do with T-SQL in MSSQL.
The result will be like that:
ResultList : (3, 4)
How is it done with Lambda Expression ?
You can use Enumerable.Intersect
var commonItems = list1.Intersect(list2).Intersect(list3).Intersect(list4);
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