I have the situation where a list must contains at least the values of another list. So imagine we have list A with values 1, 2, 3. This is the list with the required values.
List B has the values 1, 5, 6, 7
List C has the values 1, 2, 3, 4, 7
List D has the values 2, 5, 6
In this situation I only want List C, since this is the only list which contains the values 1, 2 end 3.
I've tried this, but this doesn't work since it is always true:
query = from doc in query
let tagIds = from t in doc.Tags select t.Id
where parameters.TagIds.Except(tagIds).Count() <= parameters.TagIds.Count()
select doc;
And when using this:
query = from doc in query
let tagIds = from t in doc.Tags select t.Id
where !parameters.TagIds.Except(tagIds).Any<int>()
select doc;
I only get the lists where the list matches exactly the 'required' list.
My question is, how can I solve my situation in a Linq 2 SQL query?