I have a table called Tag with a column called Label and a column called AuctionId. I also have an array of strings which are search terms. I want to write some Linq to Entities code which will give me a distinct list of AuctionIds where the the Label matches one of the search terms. Here is the pseudocode for this:
return a list of unique AuctionIds where Label is in searchTerms
How can this be done?
You can use Contains() on the list.
List<String> AuctionIDs = (from tagItem in Tags
where searchItems.Contains(tagItem.Label)
select tagItem.AutionID).Distinct().ToList();
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