Skip to content

Commit 13319f0

Browse files
committed
Clarify sync vs. async enumerable objects.
1 parent e7a46eb commit 13319f0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

standard/classes.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5599,10 +5599,9 @@ The `Dispose` or `DisposeAsync` method is used to clean up the iteration by brin
55995599

56005600
When a function member or local function returning an enumerable interface type or an async enumerable interface type is implemented using an iterator block, invoking the function does not immediately execute the code in the iterator block. Instead, an ***enumerable object*** is created and returned.
56015601

5602-
The enumerable object’s `GetEnumerator` or `GetAsyncEnumerator` method returns an enumerator object that encapsulates the code specified in the iterator block, and execution of the code in the iterator block occurs when the enumerator object’s `MoveNext` or `MoveNextAsync` method is invoked. An enumerable object has the following characteristics:
5602+
A synchronous enumerable object implements `IEnumerable` and `IEnumerable<T>` or `IAsyncEnumerable<T>`, where `T` is the yield type of the iterator. Its `GetEnumerator` returns an enumerator object (§15.15.5). An async enumerable object implements `IAsyncEnumerable<T>` where `T` is the yield type of the iterator. Its `GetAsyncEnumerator` returns an asynchronous enumerator object (§15.15.5).
56035603

5604-
- It implements `IEnumerable` and `IEnumerable<T>` or `IAsyncEnumerable<T>`, where `T` is the yield type of the iterator.
5605-
- It is initialized with a copy of the argument values (if any) and instance value passed to the function.
5604+
An enumerable object is initialized with a copy of the argument values (if any) and instance value passed to the function.
56065605

56075606
An enumerable object is typically an instance of a compiler-generated enumerable class that encapsulates the code in the iterator block and implements the enumerable interfaces, but other methods of implementation are possible. If an enumerable class is generated by the compiler, that class will be nested, directly or indirectly, in the class containing the function, it will have private accessibility, and it will have a name reserved for compiler use ([§6.4.3](lexical-structure.md#643-identifiers)).
56085607

0 commit comments

Comments
 (0)