title: A clever alternative in LINQ for iterating over HashSet<string>
body: <p>I've got a whitelist of URLs I'm using, inside a <code>HashSet&lt;string&gt;</code>. I'm trying to find if the <code>url</code> starts with any of the items in the white list (it has to be that way round).</p>
  
  <p><em>Edit:</em> The previous example was a bit misleading and had a typo - I already have a base url like yahoo.com, the whitelist is just the path.</p>
  
  <pre><code>HashSet&lt;string&gt; whiteList = new HashSet&lt;string&gt;();
  
  string path = "/sport/baseball/";
  bool validUrl = false;
  
  foreach (string item in whiteList)
  {
      if (path.StartsWith(item))
      {
          validUrl = true;
          break;
      }
  }
  </code></pre>
  
  <p>Is there a more elegant way of doing this lookup with LINQ (to objects)? The list isn't huge so performance isn't an issue.</p>