Reputation: 1
I have two table item table and transaction table. I need to use Contain to filter for two values.
var list1= table.select(c=> new {c.ID , c.ItemID}).tolist();
var list2 = tableItem.where(x=> list1.contains(x.id ,x.itemID ));
Upvotes: 0
Views: 223
Reputation: 2492
This should work for you, may require a few tweaks since you're syntax looks a little rough.
Note the Any
LINQ function I used. More details here
var list1 = table.Select(c => new { c.ID, c.ItemID }).ToList();
var list2 = tableITem.Where(x => list1.Any(a => a.ID == x.id && a.ItemID == x.itemID)).ToList();
Upvotes: 1