title: Why does casting a .NET List to IEnumerable<Interface> fail when the implementation is a struct?
body: <p>Could anyone explain why the cast below fails when the implementation of <code>IMyInterface</code> is a struct? I don't get why the runtime cares about the difference between a class and a struct here, given that the List is always a class.</p>
  
  <pre><code>public interface IMyInterface
  {
  }
  
  public class MyClass : IMyInterface
  {
  }
  
  public struct MyStruct : IMyInterface
  {
  }
  
  public static void TestCast&lt;T&gt;()
      where T : IMyInterface
  {
      var works = (IEnumerable&lt;IMyInterface&gt;)new List&lt;MyClass&gt;();
      var invalidCastException = (IEnumerable&lt;IMyInterface&gt;)new List&lt;MyStruct&gt;();
  }
  </code></pre>