title: c# add integer to list
body: <p>When I check if a textbox equals 1, I want to check if the list allready contains a specific value. When I run this, it allways goes to the else code. What am I doing wrong?</p>
  
  <pre><code>List&lt;int&gt; list = new List&lt;int&gt;();
  
  if (Convert.ToInt32(DobbelWaarde.Text) == 1)
  {
      if (list.Contains(1))
      {
          Console.WriteLine("1 is allready been chosen");
      }
      else
      {
          list.Add(1);
          Console.WriteLine();
          foreach (int li in list)
          {
              Console.WriteLine(li);
              Console.WriteLine("We add 1");
          }
      }
  }
  </code></pre>