title: Fastest Type Comparison?
body: <p>The following event can possibly get called hundreds of times a frame.</p>
  
  <pre><code>public bool OnCollision(Body body1, Body body2)
  {
   if(body2.Tag is Dog)
        ((Dog)body2.Tag).Bark();
  }
  </code></pre>
  
  <p>I understand that using "is" causes a cast to be made and then when i want to do something with it, cast it a second time. Is there a more efficient way to check the type? I made a console app trying "if(body2.Tag.GetType() == typeOf(Dog))" but it appears to be even slower than using "is".</p>
  
  <p>Thanks.</p>