title: How to dynamically add OR operator to WHERE clause in LINQ
body: <p>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 least one of the strings in the array. Here is some pseudo code:</p>
  
  <pre><code> IQueryable&lt;Songs&gt; allSongMatches = musicDb.Songs; // all rows in the table
  </code></pre>
  
  <p>I can easily query this table filtering on a fixed set of strings, like this:</p>
  
  <pre><code> allSongMatches=allSongMatches.Where(SongsVar =&gt; SongsVar.Tags.Contains("foo1") || SongsVar.Tags.Contains("foo2") || SongsVar.Tags.Contains("foo3"));
  </code></pre>
  
  <p>However, this does not work (I get the following error: "A lambda expression with a statement body cannot be converted to an expression tree")</p>
  
  <pre><code> allSongMatches = allSongMatches.Where(SongsVar =&gt;
       {
         bool retVal = false;
         foreach(string str in strArray)
         {
           retVal = retVal || SongsVar.Tags.Contains(str);
         }
         return retVal;
       });
  </code></pre>
  
  <p>Can anybody show me the correct strategy to accomplish this? I am still new to the world of LINQ :-)</p>