I'm trying to get all the assets where Class property equals to one of the values in selectedIClassesList;
Something like this:
from x in Assets where selectedIClassesList.Contains(x.Class) select x
I'm trying to get all the assets where Class property equals to one of the values in selectedIClassesList;
Something like this:
from x in Assets where selectedIClassesList.Contains(x.Class) select x
You could do a join...
var query = from a in Assets
join s in selectedClassesList on a.Class equals s
select a;
If I understand right, your problem is that IClassesList doesn't have a contains method? If IClassesList is an IEnumerable of the same type of object as x.Class, this should work.
from x in Assets where selectedIClassesList.Any(s => s == x.Class) select x
For better performance, you would do well to create a dictionary, though.
var selectedClassesDict = selectedIClassesList.ToDictionary(s => s);
var selectedAssets = from a in Assets
where selectedClassesDict.ContainsKey(a.Class)
select a;