title: Interface Casting vs. Class Casting
body: <p>I've been led to believe that casting can, in certain circumstances, become a measurable hindrance on performance. This may be moreso the case when we start dealing with incoherent webs of nasty exception throwing\catching.</p>
  
  <p>Given that I wish to create more correct heuristics when it comes to programming, I've been prompted to ask this question to the .NET gurus out there: Is interface casting faster than class casting?</p>
  
  <p>To give a code example, let's say this exists:</p>
  
  <pre><code>public interface IEntity { IParent DaddyMommy { get; } }
  public interface IParent : IEntity { }
  public class Parent : Entity, IParent { }
  public class Entity : IEntity
  {
      public IParent DaddyMommy { get; protected set; }
      public IParent AdamEve_Interfaces
      {
          get
          {
              IEntity e = this;
              while (e.DaddyMommy != null)
                  e = e.DaddyMommy as IEntity;
              return e as IParent;
          }   
      }
      public Parent AdamEve_Classes
      {
          get
          {
              Entity e = this;
              while (e.DaddyMommy != null)
                  e = e.DaddyMommy as Entity;
              return e as Parent;
          }
      }
  }
  </code></pre>
  
  <p>So, is AdamEve_Interfaces faster than AdamEve_Classes? If so, by how much? And, if you know the answer, why?</p>