title: checking an element of List is equal an input
body: <pre><code>namespace OpenXMLSample
  {
      public class Datause
      {
          List&lt;Wsdata&gt; data = new List&lt;Wsdata&gt;();
  
          public IReadOnlyCollection&lt;Wsdata&gt; Readonlydata
          {
              get
              {
                  return data.AsReadOnly();
              }
          }
  
  
          public void Dataoutput(DateTime dateinput,int x)
          {//mainde x e input gircen unutma 
  
  
              while (true)
              {
                  x = 1;
                  Console.WriteLine("please select:\ninput a date:1 \nclose:2");
                  x = Convert.ToInt32(Console.ReadLine());
  
                  if (x == 1)
                  {
                      Console.WriteLine("Enter a date in dd/mm/yyyy format:");
                      DateTime.TryParse(Console.ReadLine(),out dateinput);
  
                      //date ve Dates farki bak
                      for (int i = 0; i &lt; data.Count; i++)
                      {
                          if (data[i].Dates.Equals(dateinput))
                          {
                              Console.WriteLine("Date:", data[i].Dates);
                              Console.WriteLine("Dolar:", data[i].Dolar);
                              Console.WriteLine("Euro:", data[i].Euro);
                          }
                      }
  
                      //devam falan bak 
                      continue;
                  }
                  else if (x == 2)
                      break;
                  else
                      Console.WriteLine("ERROR!, please wtrite 1 or 2");
                      break;
              }
          }   
      }
  }
  </code></pre>
  
  <p>My problem is that the <code>if(data[i].Dates.Equals(dateinput))</code> block does not run. Also it does not execute the <code>i++</code> part of the <code>for</code> - loop.</p>
  
  <p>Does anyone know why?</p>