Can't test for Null hashtable value in C# program
<p>I have a Hashtable called EmployeeInformation in my ASP.Net 4.0 web page (written in C#) and I want to check if a particular item ("DateEff") in the Hashtable has a null value. When I walk through the code with the debugger, I see that EmployeeInformation["DateEff"] has a value of {Null}. However, when I get to this condition:</p>

<pre><code>if (EmployeeInformation["Context"].ToString() != "Existing" &amp;&amp; EmployeeInformation["DateEff"] != null &amp;&amp; EmployeeInformation["DateEff"].ToString() != "")
     &lt;do something here&gt;
</code></pre>

<p>my code sees that all three conditions are true and continues on to the "do something here" line of code. I've tried using</p>

<pre><code>string.IsNullOrEmpty(EmployeeInformation["DateEff"])
</code></pre>

<p>also, but the result is the same. I have also checked that EmployeeInformation contains the key DateEff and it does. Does anyone know why this is happening?</p>

<hr>

<p>Based on MethodMan's comment below, I went back to see how I was populating the Hashtable. Here's what I'm doing:</p>

<pre><code>string strDateHired = txtDateHired.Text;
            if (strDateHired == string.Empty)
                dtDateHired = SqlDateTime.Null;
            else
                dtDateHired = Convert.ToDateTime(strDateHired);
            EmployeeInformation.Add("DateEff", dtDateHired);
</code></pre>

<p>So the problem is that my value isn't null, it's SqlDateTime.Null. But how do I test for that? I can't convert EmployeeInformation["DateEff"] to a DateTime because it's empty.</p>