Written on msdn:
Returns the input typed as
IEnumerable<T>
.
I do not understand. Help me to understand this method.
Written on msdn:
Returns the input typed as
IEnumerable<T>
.
I do not understand. Help me to understand this method.
Copyright © 2021 Jogjafile Inc.
There are three implementations of
AsEnumerable
.DataTableExtensions.AsEnumerable
Extends a
DataTable
to give it anIEnumerable
interface so you can use Linq against theDataTable
.Enumerable.AsEnumerable<TSource>
andParallelEnumerable.AsEnumerable<TSource>
In other words.
If I have an
from a Linq Provider, like Entity Framework, and I do,
that query will be composed on and run on the server. This will fail at runtime because Entity Framework doesn't know how to convert
SomeUnusualPredicate
into SQL.If I want that to run the statement with Linq to Objects instead, I do,
now the server will return all the data and the
Enumerable.Where
from Linq to Objects will be used instead of the Query Provider's implementation.It won't matter that Entity Framework doesn't know how to interpret
SomeUnusualPredicate
, my function will be used directly. (However, this may be an inefficient approach since all rows will be returned from the server.)