title: Casting List<MyObject> to IEnumerable<MyInterface>
body: <p>I'm still learning some of this c# stuff, and I couldn't find an answer to this question. Assuming that I have a list of MyObject implementing MyInterface</p>
  
  <pre><code>public class MyObject : IMyInterface { ...}
  
  public List&lt;MyObject&gt; MyObjectList;
  </code></pre>
  
  <p>How can I return an <code>IEnumerable&lt;IMyInterface&gt;</code> with the contents of MyObjectList? </p>
  
  <p>I mean, right now I have this:</p>
  
  <pre><code>List&lt;IMyInterface&gt; temp = new List&lt;IMyInterface&gt;();
  foreach (MyObject obj in MyObjects) temp.Add(obj);
  return (IEnumerable&lt;IMyInterface&gt;)temp;
  </code></pre>
  
  <p>But is it necessary to create a new list like this?</p>
  
  <p>Thank you.</p>