string[] fruits = { "apple", "passionfruit", "banana", "mango",
"orange", "blueberry", "grape", "strawberry" };
List<int> lengths = fruits.Select(fruit => fruit.Length).ToList();
Enumerable.ToList()
or Enumerable.ToArray()
performs eager evaluation, they force the evaluation.
Does Enumerable.AsEnumerable()
do the same ?
Thanks
In short, no. It does absolute nothing at all, it just return the input collection, typed with a different interface.
It's only practical purpose it to switch from IQueryable<T>
to IEnumerable<T>
, so that further LINQ methods are performed with the enumerable version instead of the queryable, making evaluation to go to "client-side".
But, in itself, it doesn't do anything.