I have a variable size array of strings, and I am trying to programatically loop through the array and match all the rows in a table where the column \"Tags\" contains at le
You can use the PredicateBuilder class:
var searchPredicate = PredicateBuilder.False();
foreach(string str in strArray)
{
var closureVariable = str; // See the link below for the reason
searchPredicate =
searchPredicate.Or(SongsVar => SongsVar.Tags.Contains(closureVariable));
}
var allSongMatches = db.Songs.Where(searchPredicate);
LinqToSql strange behaviour