Skip to content

Commit

Permalink
Fixes #879
Browse files Browse the repository at this point in the history
Clarify the required accessibility of any task builder type and its required members.

Note that we will need to update this text once dotnet/roslyn#71283 is fixed and merged.
  • Loading branch information
BillWagner committed Dec 15, 2023
1 parent 475fc40 commit 82f7f39
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions standard/classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5354,13 +5354,13 @@ Task types can vary in their exact definition, but from the language’s point o
>
> *end example*
A task builder type is a class or struct type that corresponds to a specific task type ([§15.15.2](classes.md#15152-task-type-builder-pattern)).
A task builder type is a class or struct type that corresponds to a specific task type ([§15.15.2](classes.md#15152-task-type-builder-pattern)). The task builder type must have the same declared accessibility as its corresponding task type.
An async function has the ability to suspend evaluation by means of await expressions ([§12.9.8](expressions.md#1298-await-expressions)) in its body. Evaluation may later be resumed at the point of the suspending await expression by means of a ***resumption delegate***. The resumption delegate is of type `System.Action`, and when it is invoked, evaluation of the async function invocation will resume from the await expression where it left off. The ***current caller*** of an async function invocation is the original caller if the function invocation has never been suspended or the most recent caller of the resumption delegate otherwise.
### 15.15.2 Task-type builder pattern
A task builder type can have at most one type parameter and cannot be nested in a generic type. A task builder type shall have the following accessible members (for non-generic task builder types, `SetResult` has no parameters):
A task builder type can have at most one type parameter and cannot be nested in a generic type. A task builder type shall have the following members (for non-generic task builder types, `SetResult` has no parameters) with declared `public` accessibility:
```csharp
class «TaskBuilderType»<T>
Expand All @@ -5382,7 +5382,7 @@ class «TaskBuilderType»<T>
public «TaskType»<T> Task { get; }
}
```
The compiler generates code that uses the «TaskBuilderType» to implement the semantics of suspending and resuming the evaluation of the async function. The compiler uses the «TaskBuilderType» as follows:

- `«TaskBuilderType».Create()` is invoked to create an instance of the «TaskBuilderType», named `builder` in this list.
Expand Down

0 comments on commit 82f7f39

Please sign in to comment.