“YieldExceptionYield” (Solution)
Answer
Exception is not going to happen.
Explanation
Indeed, the line
is only building a query, but does not execute it. The line
is also only building another query without direct execution. Let's look to the last list of the Main
method:
This call will get only the first element of the result enumerable (single call of MoveNext()
and Current
will be executed). Evaluation of the next elements will nor occur. Thus, the code will work without any exceptions.
Last updated