title: Improve this code: List.Contains Regex without creating a new comparison object?
body: <p>I threw down this code to implement a Regex variant of List.Contains() in LinqPad.  It unfortunately forces one to create an object to do the comparisons and of course static classes cannot implement interfaces.  Is there any way to achieve the same result without creating a separate object to do the compare?</p>
  
  <pre><code>void Main()
  {
      var a = new List&lt;string&gt;();
      a.Add(" Monday ");
      a.Add(" Tuesday ");
      a.Add(" Wednesday ");
      a.Add(" Thursday ");
      a.Add(" Friday ");
  
      a.Contains(@"sday\s$", new ListRegexComparer() ).Dump();
  }
  
  // Define other methods and classes here
  class ListRegexComparer : IEqualityComparer&lt;string&gt;
  {
  
      public bool Equals(string listitem, string regex)
      {
          return Regex.IsMatch(listitem, regex);
      }
  
  
      public int GetHashCode(string listitem)
      {
          return listitem.GetHashCode();
      }
  
  }
  </code></pre>
  
  <p>Edit:</p>
  
  <pre><code>a.Any(s =&gt; Regex.IsMatch(s, @"(?i)sday\s$")).Dump()
  </code></pre>
  
  <p>Nice, in-line way without creating objects to do it from Chris Tavares and Jean Hominal.</p>