Skip to content

Commit

Permalink
add example annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
RexJaeschke authored and BillWagner committed Feb 6, 2023
1 parent 33634fb commit 6bd175d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5203,10 +5203,13 @@ A method that creates an asynchronous stream has the following characteristics:
> *Example*:
>
> <!-- Example: {template:"code-in-partial-class", name:"AsyncStreamCandU1", additionalFiles:["Support1AsyncStreams.cs"], ignoreOutput:true} -->
> <!-- Maintenance Note: A version of this method exists in additional-files as "Support2AsyncStreams.cs". As such, certain changes to this method definition might need to be reflected in that file, in which case, *all* examples using that file should be tested. -->
> <!-- Note: The output is ignored, as it is asynchronous, and might not be complete. -->
> ```csharp
> public static async System.Collections.Generic.IAsyncEnumerable<int> GenerateSequence()
> static async IAsyncEnumerable<int> GenerateSequence()
> {
> for (int i = 0; i < 20; i++)
> for (int i = 0; i <= 5; i++)
> {
> await Task.Delay(100);
> yield return i;
Expand All @@ -5220,10 +5223,16 @@ Consumption of an asynchronous stream requires an `await foreach` to enumerate t
> *Example*:
>
> <!-- Example: {template:"code-in-partial-class", name:"AsyncStreamCandU2", additionalFiles:["Support2AsyncStreams.cs"], ignoreOutput:true} -->
> <!-- Maintenance Note: A version of this method exists in additional-files as "Support1AsyncStreams.cs". As such, certain changes to this method definition might need to be reflected in that file, in which case, *all* examples using that file should be tested. -->
> <!-- Note: The output is ignored, as it is asynchronous, and might not be complete. -->
> ```csharp
> await foreach (var number in GenerateSequence())
> static async Task M()
> {
> Console.WriteLine(number);
> await foreach (var number in GenerateSequence())
> {
> Console.WriteLine(number);
> }
> }
> ```
>
Expand Down

0 comments on commit 6bd175d

Please sign in to comment.