title: c# get a specific element of a HashSet
body: <p>I want to get an element of a HashSet only if it contains a specific string in it. i tried
  the code below, but i dont get anything... like no matching. but this cant happen cause the UnKnown counter is always 0.</p>
  
  <pre><code>if (!IsbnAuth.Contains(RecTitle))
  {
      Unknown++;
  }
  else
  {
      for (int i = 0; i &lt; IsbnAuth.Count(); i++)
      {
          if (IsbnAuth.ElementAt(i).Contains(RecTitle))
          {
              System.Console.WriteLine(IsbnAuth.ElementAt(i));
              //isbn = IsbnAuth.ElementAt(i).Substring(0, IsbnAuth.ElementAt(i).IndexOf("\t"));
              isbn = IsbnAuth.ElementAt(i).Split(' ')[0];
              break;
          }
      }
  }
  </code></pre>
  
  <p>Any ideas? the problem is not at the RecTitle cause even if it was just a single char instead, the result would be the same.
  IsbnAuth is the HashSet.</p>
  
  <p>EDIT: IsbnAuth declaration</p>
  
  <pre><code>    HashSet&lt;String&gt; IsbnAuth = new HashSet&lt;String&gt;();
      foreach (String line in IsbnAuthors)
      {
          IsbnAuth.Add(line.Trim());
      }
      System.Console.WriteLine(IsbnAuth.Count);
  </code></pre>