title: foreach loop only on certain characters from a string
body: <p>I'm trying to pull the values inside I'm checking for outside a function as a public List.</p>
  
  <p>from this</p>
  
  <pre><code>charString.Where(n =&gt; n == ';' || n == '|' || n == '\t' || n == ':' || n == ','))
  </code></pre>
  
  <p>to this</p>
  
  <pre><code>public List&lt;char&gt; PossibleDelimiters = new List&lt;char&gt; { ';', '|' ,'\t' , ':', ',' };
  </code></pre>
  
  <p>Then check against inside the function</p>
  
  <pre><code>foreach (char currentChar in charString.Where(n =&gt; n == ';' || n == '|' || n == '\t' || n == ':' || n == ',')) 
  {
      int foundCharOccreence = 0;
      foreach (char charToBeMatch in charString.Where(n =&gt; n == ';' || n == '|' || n == '\t' || n == ':' || n == ',')) 
      {
          if (currentChar == charToBeMatch)
              foundCharOccreence++;
      }
      if (mostOccurrence &lt; foundCharOccreence) 
      {
          mostOccurrence = foundCharOccreence;
          mostOccurringChar = currentChar;
      }
  }
  </code></pre>
  
  <p>I tried to attempt the following:</p>
  
  <pre><code>foreach (char currentChar in charString.Where(PossibleDelimiters.Contains()) 
  {
  </code></pre>
  
  <p>But I'm sure what to check against. I want to execute the <code>foreach</code> loop only the characters in the list.</p>
  
  <p>Any help is appreciated.</p>