Hi all I have a query using Linq that returns a set of records, one of which is the country id, I also have an array of desired countries. Is there a way of either looping through the countries array and seeing if the id is in the results, i want to do something like this
results = from r in results
where
//jump to my c# array
for(int x = 0;x < array.count; x++)
{
r.countryId.ToString().Contains(array[x])
}
select r
thanks
Try this
var list = from r in results
where array.Contains(r.countryId.ToString())
select r;
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