title: How do i check if file end with specific extension then add the file to a List?
body: <pre><code>string ext = Path.GetExtension(file);
  if (!files.Contains(file) &amp;&amp; file.Contains(textBox2.Text))
     {
       files.Add(file);
     }
  </code></pre>
  
  <p>In textBox2.Text the value is cs or if i type .cs or *.cs
  I want that only files with this extensions of cs will be added to the List files.</p>
  
  <p>The second contains: <code>file.Contains(textBox2.Text)</code> is wrong since i want to check for the extension and not any place with cs.</p>