title: Comparing nullable DateTime's in VB.net
body: <p>I am a c#/asp.net developer and I am having to work on a VB/asp.net. 
  I started out with VB.NET but after years away from it I'm getting confused with the syntax.</p>
  
  <p>I have two variables   </p>
  
  <pre><code>Dim originalDate as DateTime?
  Dim newDate as DateTime?
  </code></pre>
  
  <p>Both nullable datetimes, originalDate is a nullable date I am getting from the database and newDate time is set in code, I need to compare them, they can either both have dates, neither have dates or one have and one not.</p>
  
  <p>I have a bit of code as follows:</p>
  
  <pre><code>if origEndDate = origEndDate then
  </code></pre>
  
  <p>When both origEndDate and origEndDate are "nothing" this statement is false (well when I run it in the watch window it comes back as nothing)!</p>
  
  <p>I don't understand why this is the case because I was under the impression doing an "=" compares the two values and as they are the same surely it should be true?</p>
  
  <p>Can someone explain what I am doing wrong? What syntax should I be using as in C# I can do the above as so:</p>
  
  <pre><code>if (origEndDate == origEndDate) { }
  </code></pre>
  
  <p>and it will come back as true.</p>
  
  <p>Confused!</p>
  
  <p>Thanks for any help!</p>