title: c# DateTime.Equals() not working properly
body: <p>I am trying to compare two DateTime variables which are having the same values in it. </p>
  
  <p>But when I use Equals method it returns false which indicates "Not Equal".</p>
  
  <p>My code is :</p>
  
  <pre><code>DateTime date = DateTime.Parse("2/27/2010 1:06:49 PM");
  foreach (KeyValuePair&lt;DateTime, List&lt;string&gt;&gt; k in Sample)
  {
     if (date.Equals(k.Key))
     {
        Console.WriteLine("Yes");
     }
     else {
        Console.WriteLine("No");
     }
  }
  </code></pre>
  
  <p>The dictionary Sample contains the following keys :</p>
  
  <ul>
  <li>5/8/2018 11:18:00 AM</li>
  <li>5/8/2018 11:17:46 AM </li>
  <li>2/27/2010 1:06:49 PM       </li>
  <li>5/8/2018 11:18:08 AM</li>
  </ul>
  
  <p>The third key value is same as the comparing value.</p>
  
  <p>And for all the key I get no as output.</p>
  
  <p>Can anyone explain why it is happening like this ?</p>