You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So disposing the enumerator acts as if you had reached the end of the enumeration. Whereas if you do the same thing on an IAsyncEnumerator, it will actually restart the enumeration from the start, because the implementation of MoveNextAsync will lazily start enumeration if _yield and _enumerationTask are null, and they are both set to null during Dispose.
The text was updated successfully, but these errors were encountered:
Consider the following example
If you compare this to an
IEnumerable
that is disposable, such as the following:This has the following behavior:
So disposing the enumerator acts as if you had reached the end of the enumeration. Whereas if you do the same thing on an
IAsyncEnumerator
, it will actually restart the enumeration from the start, because the implementation ofMoveNextAsync
will lazily start enumeration if_yield
and_enumerationTask
are null, and they are both set to null duringDispose
.The text was updated successfully, but these errors were encountered: