Is there anything wrong with having a return type of IEnumerable<T> or ICollection<T> but returning a List<T>?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/271710/collectiont-versus-listt-what-should-you-use-on-your-interfaces">Collection&lt;T&gt; versus List&lt;T&gt; what should you use on your interfaces?</a>  </p>
</blockquote>



<p>So right now I have a method similar to this:</p>

<pre><code>public IEnumerable&lt;T&gt; MyMethod(string stuff)
{
     var myVar = new List&lt;T&gt;();
     //do stuff

     return myVar;
}
</code></pre>

<p>Essentially, the 'do stuff' goes through a <code>DataRow</code> and assigns the value to a list of objects. I also have similar situations with <code>ICollection</code> or <code>IList</code> return type in other places.</p>

<p>The reason I want to return either <code>IEnumerable</code> or <code>ICollection</code> is so I'm not returning more than needed, and the caller can convert it to a <code>List</code> if it needs.</p>

<p>However, it seems weird the my return statement is returning a <code>List</code>, instead of what the method's return type is. Is this normal practice? Is there anything wrong with doing this?</p>

<p><strong>EDIT(in response to the dupe comments):</strong></p>

<p>Just to clarify, what I'm curious about is if it is okay that my return statement in the body is returning a <code>List&lt;T&gt;</code>, but the method header has a return-type of <code>IEnumerable</code>, or possibly <code>ICollection</code>, <code>Collection</code>, etc... Something <em>different</em> than than bodies return statement.</p>
