|
| .NET Framework Class Library |
| Task Constructor (Action, TaskCreationOptions) |
| Task Class See Also Send Feedback |
Initializes a new Task with the specified action and creation options.
Namespace:
System.Threading.Tasks
Assembly:
System.Threading (in System.Threading.dll)
Syntax
| Visual Basic (Declaration) |
|---|
Public Sub New ( _ action As Action, _ creationOptions As TaskCreationOptions _ ) |
| C# |
|---|
public Task( Action action, TaskCreationOptions creationOptions ) |
Parameters
- action
- Type: System..::.Action
The delegate that represents the code to execute in the task.
- creationOptions
- Type: System.Threading.Tasks..::.TaskCreationOptions
The TaskCreationOptions used to customize the Task's behavior.
Exceptions
| Exception | Condition |
|---|---|
| System..::.ArgumentNullException | The action argument is null. |
| System..::.ArgumentOutOfRangeException | The creationOptions argument specifies an invalid value for TaskCreationOptions. |