Is there a nice way to get a boolean from a Hashtable?
<p>I'm trying to retrieve a boolean from a hashtable... my code looks something like this:</p>

<pre><code>Hashtable h = new Hastable();

...

h["foo"] = true;

...

object o = h["foo"];
if( o == null ) { return false; }
if( o.GetType() != typeof(bool) ) { return false; }
return (bool)o;
</code></pre>

<p>In contrast I use something like this for objects</p>

<pre><code>return h["foo"] as MyObject;
</code></pre>

<p>Is there a nicer solution for booleans?</p>
