Please suppose I have the following extension method in order to be able to force evaluation of an IEnumerable
:
public static List<T> EvaluateNow<T>(this IEnumerable<T> collection)
{
if (collection == null)
{
throw new ArgumentNullException("collection");
}
else
{
return (collection.ToList());
}
}
I would like to ask if there is any point in having IList<T>
instead of List<T>
as this method's return type (i.e., downcasting to an interface) in order to tie neither it nor its dependencies to a particular implementation (even if the return value will always actually be a List
).