Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Threading.​Tasks.​TaskFactory
Assembly: System.Runtime
Inheritance: object → TaskFactory
Provides support for creating and scheduling <see cref="T:System.Threading.Tasks.Task" /> objects.
Properties
public
CancellationToken
CancellationToken
Gets the default cancellation token for this task factory.
public
TaskContinuationOptions
ContinuationOptions
Gets the default task continuation options for this task factory.
public
TaskCreationOptions
CreationOptions
Gets the default task creation options for this task factory.
public
TaskScheduler
Scheduler
Gets the default task scheduler for this task factory.
Methods
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
CancellationToken cancellationToken)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task.
scheduler
The object that is used to schedule the new continuation task.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
TaskContinuationOptions continuationOptions)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
CancellationToken cancellationToken)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
scheduler
The object that is used to schedule the new continuation task.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
TaskContinuationOptions continuationOptions)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
CancellationToken cancellationToken)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
scheduler
The object that is used to schedule the new continuation task.
public
Task
ContinueWhenAll​(Task[] tasks,
Action<​Task[]> continuationAction,
TaskContinuationOptions continuationOptions)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationAction
The action delegate to execute when all tasks in the <paramref name="tasks" /> array have completed.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
CancellationToken cancellationToken)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
cancellationToken
The cancellation token to assign to the new continuation task.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
scheduler
The object that is used to schedule the new continuation task.
public
Task<​TResult>
ContinueWhenAll​(Task[] tasks,
Func<​Task[], TResult> continuationFunction,
TaskContinuationOptions continuationOptions)
Creates a continuation task that starts when a set of specified tasks has completed.
Returns The new continuation task.
tasks
The array of tasks from which to continue.
continuationFunction
The function delegate to execute asynchronously when all tasks in the <paramref name="tasks" /> array have completed.
continuationOptions
A bitwise combination of the enumeration values that control the behavior of the new continuation task. The NotOn and OnlyOn members are not supported.
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task> continuationAction)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task> continuationAction,
CancellationToken cancellationToken)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task> continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the created continuation <see cref="T:System.Threading.Tasks.Task" /> .
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task> continuationAction,
TaskContinuationOptions continuationOptions)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task" /> .
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task, TResult> continuationFunction)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task, TResult> continuationFunction,
CancellationToken cancellationToken)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task, TResult> continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task, TResult> continuationFunction,
TaskContinuationOptions continuationOptions)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task<​TAntecedentResult>> continuationAction)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task<​TAntecedentResult>> continuationAction,
CancellationToken cancellationToken)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task<​TAntecedentResult>> continuationAction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
ContinueWhenAny​(Task[] tasks,
Action<​Task<​TAntecedentResult>> continuationAction,
TaskContinuationOptions continuationOptions)
Creates a continuation <see cref="T:System.Threading.Tasks.Task" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationAction
The action delegate to execute when one task in the <paramref name="tasks" /> array completes.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task" /> .
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task<​TAntecedentResult>, TResult> continuationFunction)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task<​TAntecedentResult>, TResult> continuationFunction,
CancellationToken cancellationToken)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task<​TAntecedentResult>, TResult> continuationFunction,
CancellationToken cancellationToken,
TaskContinuationOptions continuationOptions,
TaskScheduler scheduler)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
cancellationToken
The <see cref="T:System.Threading.CancellationToken" /> that will be assigned to the new continuation task.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task<​TResult>
ContinueWhenAny​(Task[] tasks,
Func<​Task<​TAntecedentResult>, TResult> continuationFunction,
TaskContinuationOptions continuationOptions)
Creates a continuation <see cref="T:System.Threading.Tasks.Task`1" /> that will be started upon the completion of any Task in the provided set.
Returns The new continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
tasks
The array of tasks from which to continue when one task completes.
continuationFunction
The function delegate to execute asynchronously when one task in the <paramref name="tasks" /> array completes.
continuationOptions
The <see cref="T:System.Threading.Tasks.TaskContinuationOptions" /> value that controls the behavior of the created continuation <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
FromAsync​(Func<​AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task
FromAsync​(Func<​AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
public
Task
FromAsync​(IAsyncResult asyncResult,
Action<​IAsyncResult> endMethod)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that executes an end method action when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The action delegate that processes the completed <paramref name="asyncResult" /> .
public
Task
FromAsync​(IAsyncResult asyncResult,
Action<​IAsyncResult> endMethod,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that executes an end method action when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The action delegate that processes the completed <paramref name="asyncResult" /> .
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
public
Task
FromAsync​(IAsyncResult asyncResult,
Action<​IAsyncResult> endMethod,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that executes an end method action when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The action delegate that processes the completed <paramref name="asyncResult" /> .
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the task that executes the end method.
public
Task<​TResult>
FromAsync​(Func<​AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task<​TResult>
FromAsync​(Func<​AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
FromAsync​(Func<​TArg1, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task
FromAsync​(Func<​TArg1, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
public
Task<​TResult>
FromAsync​(IAsyncResult asyncResult,
Func<​IAsyncResult, TResult> endMethod)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that executes an end method function when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The function delegate that processes the completed <paramref name="asyncResult" /> .
public
Task<​TResult>
FromAsync​(IAsyncResult asyncResult,
Func<​IAsyncResult, TResult> endMethod,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that executes an end method function when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The function delegate that processes the completed <paramref name="asyncResult" /> .
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task<​TResult>
FromAsync​(IAsyncResult asyncResult,
Func<​IAsyncResult, TResult> endMethod,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that executes an end method function when a specified <see cref="T:System.IAsyncResult" /> completes.
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
asyncResult
The IAsyncResult whose completion should trigger the processing of the <paramref name="endMethod" /> .
endMethod
The function delegate that processes the completed <paramref name="asyncResult" /> .
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
scheduler
The <see cref="T:System.Threading.Tasks.TaskScheduler" /> that is used to schedule the task that executes the end method.
public
Task<​TResult>
FromAsync​(Func<​TArg1, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task<​TResult>
FromAsync​(Func<​TArg1, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
FromAsync​(Func<​TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
TArg2 arg2,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task
FromAsync​(Func<​TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
TArg2 arg2,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
public
Task<​TResult>
FromAsync​(Func<​TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
TArg2 arg2,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task<​TResult>
FromAsync​(Func<​TArg1, TArg2, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
TArg2 arg2,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
FromAsync​(Func<​TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
arg3
The third argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task
FromAsync​(Func<​TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod,
Action<​IAsyncResult> endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
arg3
The third argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task" /> .
public
Task<​TResult>
FromAsync​(Func<​TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
arg3
The third argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
public
Task<​TResult>
FromAsync​(Func<​TArg1, TArg2, TArg3, AsyncCallback, object, IAsyncResult> beginMethod,
Func<​IAsyncResult, TResult> endMethod,
TArg1 arg1,
TArg2 arg2,
TArg3 arg3,
object state,
TaskCreationOptions creationOptions)
Creates a <see cref="T:System.Threading.Tasks.Task`1" /> that represents a pair of begin and end methods that conform to the Asynchronous Programming Model pattern.
Returns The created <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous operation.
beginMethod
The delegate that begins the asynchronous operation.
endMethod
The delegate that ends the asynchronous operation.
arg1
The first argument passed to the <paramref name="beginMethod" /> delegate.
arg2
The second argument passed to the <paramref name="beginMethod" /> delegate.
arg3
The third argument passed to the <paramref name="beginMethod" /> delegate.
state
An object containing data to be used by the <paramref name="beginMethod" /> delegate.
creationOptions
The TaskCreationOptions value that controls the behavior of the created <see cref="T:System.Threading.Tasks.Task`1" /> .
public
Task
StartNew​(Action action)
Creates and starts a task for the specified action delegate.
Returns The started task.
action
The action delegate to execute asynchronously.
public
Task
StartNew​(Action action,
CancellationToken cancellationToken)
Creates and starts a task for the specified action delegate and cancellation token.
Returns The started task.
action
The action delegate to execute asynchronously.
cancellationToken
The cancellation token that will be assigned to the new task.
public
Task
StartNew​(Action action,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates and starts a task for the specified action delegate, cancellation token, creation options and state.
Returns The started task.
action
The action delegate to execute asynchronously.
cancellationToken
The cancellation token that will be assigned to the new task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
scheduler
The task scheduler that is used to schedule the created task.
public
Task
StartNew​(Action action,
TaskCreationOptions creationOptions)
Creates and starts a task for the specified action delegate and creation options.
Returns The started task.
action
The action delegate to execute asynchronously.
creationOptions
One of the enumeration values that controls the behavior of the created task.
public
Task
StartNew​(Action<​object> action,
object state)
Creates and starts a task for the specified action delegate and state.
Returns The started task.
action
The action delegate to execute asynchronously.
state
An object containing data to be used by the <paramref name="action" /> delegate.
public
Task
StartNew​(Action<​object> action,
object state,
CancellationToken cancellationToken)
Creates and starts a task for the specified action delegate, state and cancellation token.
Returns The started task.
action
The action delegate to execute asynchronously.
state
An object containing data to be used by the <paramref name="action" /> delegate.
cancellationToken
The cancellation token that will be assigned to the new task.
public
Task
StartNew​(Action<​object> action,
object state,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates and starts a task for the specified action delegate, state, cancellation token, creation options and task scheduler.
Returns The started task.
action
The action delegate to execute asynchronously.
state
An object containing data to be used by the <paramref name="action" /> delegate.
cancellationToken
The cancellation token that will be assigned to the new task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
scheduler
The task scheduler that is used to schedule the created task.
public
Task
StartNew​(Action<​object> action,
object state,
TaskCreationOptions creationOptions)
Creates and starts a task for the specified action delegate, state and creation options.
Returns The started task.
action
The action delegate to execute asynchronously.
state
An object containing data to be used by the <paramref name="action" /> delegate.
creationOptions
One of the enumeration values that controls the behavior of the created task.
public
Task<​TResult>
StartNew​(Func<​object, TResult> function,
object state)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate and state.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
state
An object containing data to be used by the <paramref name="function" /> delegate.
public
Task<​TResult>
StartNew​(Func<​object, TResult> function,
object state,
CancellationToken cancellationToken)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate, state and cancellation token.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
state
An object containing data to be used by the <paramref name="function" /> delegate.
cancellationToken
The cancellation token that will be assigned to the new task.
public
Task<​TResult>
StartNew​(Func<​object, TResult> function,
object state,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate, state, cancellation token, creation options and task scheduler.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
state
An object containing data to be used by the <paramref name="function" /> delegate.
cancellationToken
The cancellation token that will be assigned to the new task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
scheduler
The task scheduler that is used to schedule the created task.
public
Task<​TResult>
StartNew​(Func<​object, TResult> function,
object state,
TaskCreationOptions creationOptions)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate, state and creation options.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
state
An object containing data to be used by the <paramref name="function" /> delegate.
creationOptions
One of the enumeration values that controls the behavior of the created task.
public
Task<​TResult>
StartNew​(Func<​TResult> function)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
public
Task<​TResult>
StartNew​(Func<​TResult> function,
CancellationToken cancellationToken)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate and cancellation token.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
cancellationToken
The cancellation token that will be assigned to the new task.
public
Task<​TResult>
StartNew​(Func<​TResult> function,
CancellationToken cancellationToken,
TaskCreationOptions creationOptions,
TaskScheduler scheduler)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate, cancellation token, creation options and task scheduler.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
cancellationToken
The cancellation token that will be assigned to the new task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
scheduler
The task scheduler that is used to schedule the created task.
public
Task<​TResult>
StartNew​(Func<​TResult> function,
TaskCreationOptions creationOptions)
Creates and starts a task of type <typeparamref name="TResult" /> for the specified function delegate and creation options.
Returns The started task.
function
A function delegate that returns the future result to be available through the task.
creationOptions
One of the enumeration values that controls the behavior of the created task.
public
bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.