Possible duplicate:
LINQ: check if the array is a subset of another
I am trying to determine if there is a way to use LINQ to determine if each element of a subset array is in an array of supernets. For example, with this superset:
{'w','o','k','r','d','o'}
Below is a valid subset:
{'o','k','w','r'}
While they are not valid:
{'o','k','w','r','s'}
{'w','o','k','r','d','o','s'}
The actual superset is the char array that I have in memory. The actual subset is the value in the database table. I am trying to use LINQ to EF to get all the values from a table matching this condition. This is what I have tried so far:
char[] letterArray = letters.ToCharArray();
return we.Words.Where(t => letterArray.Join(t.Word.ToCharArray(),
f => f,
s => s, (f, s) => new { s }).Count() == t.Word.Length
).Select(t => t.Word).ToArray();
But when I run this, I get an error:
' "System.Char". ( Int32, String Guid) .
? , ?