title: HashSet IntersectWith count words but only unique
body: <p>I got richtextBox control in form and a text file. I am getting text file to array and getting <code>richtextbox1.text</code> to other array than compare it and count words matching.</p>
  
  <p>But for example there are two "name" word in text file and three "and" word in richtextbox. So if there is two same word in text file in richtextbox it cant be 3 or higher after 2, it must be wrong word so it must not be counted. But HashSet is counting unique values only not looking for duplicates in text file. I want to compare every word in text file with words in RichTextBox.</p>
  
  <p>My code is here:</p>
  
  <pre><code>        StreamReader sr = new StreamReader("c:\\test.txt",Encoding.Default);
          string[] word = sr.ReadLine().ToLower().Split(' ');
          sr.Close();
          string[] word2 = richTextBox1.Text.ToLower().Split(' ');
          var set1 = new HashSet&lt;string&gt;(word);
          var set2 = new HashSet&lt;string&gt;(word2);
          set1.IntersectWith(set2);
  
          MessageBox.Show(set1.Count.ToString());
  </code></pre>