I wanna write a linq query to do this
Select id from selectedBrands
where name='Nick' or name='Matt'
is this linq correct????
var brandsToNotShow=new[] {"Nick","Matt"};
model.Names=
(from s in selectedBrands
where brandsToNotShow.Any()
select s.Brand.name
).ToList();
where model.Names is a List
No, it is not correct.
asks “are there any elements of this list”, the answer to which is, yes, there are two elements.
This query is probably closer to what you want:
(actually, if it’s brands NOT to show, it might be
I can’t tell from your example)