title: C# Finding the word that only appears once in an array
body: <p>I have this array full of colors and have to find the one that only appears once in the array.</p>
  <pre><code>string[] colors = {&quot;red&quot;,&quot;green&quot;,&quot;white&quot;,&quot;green&quot;,&quot;red&quot;,&quot;red&quot;}
  
  string[] noDupcolors = szinek.Distinct().ToArray(); //the same array without duplicates
              
  int num = 0;
  int once = 0;
  for (int i = 0; i &lt; noDupcolors.Length; i++)
  {
      for (int j = 0; j &lt; S; j++)
      {
          if (noDupcolors[i]==colors[j])
          {
              num++;
          }
          if (num == 1)
          {
              once = j;
          }
          else
          {
              nums = 0;
          }
      }
  }
  Console.WriteLine(colors[once]);
  </code></pre>
  <p>I've tried this but for some reason it writes out green.
  Can someone help please. Thank you.</p>