AsQueryable - where will be the Logic when I execute it?

170 Views Asked by At

When I do

var arr = new int[] { 100, 200, 300, 400 };
var q = arr.AsQueryable();

q is an IQueryable<int> (concrete an EnumerableQuery<int>). Now, when I call

Queryable.Sum(q)

where can I find the sum-Logic? When I look into the Sum-Method, I see that there will the Expression-Tree executed with the Method Queryable.Sum. But where can I find the Iteration over the array which will sum the values?

I understand that AsQueryable will create the Expression of the IEnumerable and Queryable.Sum() executes it with the EnumerableQuery-Provider but where is the effective Logic which will be executed?

0

There are 0 best solutions below