How to rewrite if (...) to switch about identifying dynamic class type?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/708911/using-case-switch-and-gettype-to-determine-the-object">Using Case/Switch and GetType to determine the object</a>  </p>
</blockquote>



<p>If I hope to rewrite my codes with syntax if (...) else if (...) into the syntax with switch (...) case for following codes, how to achieve it ?</p>

<pre><code>void Foo(object aObj) {
      if (aObj is Dictionary&lt;int,object&gt; ) {

      } else if (aObj is string) {

      } else if (aObj is int) {

      } else if (aObj is MyCustomClass) {

      } else {
         throw new Exception("unsupported class type.");
      }
   }
</code></pre>
