class Task
in global :: System . Threading . Tasks
Represents an asynchronous operation.
public object AsyncState { get; }
Gets the state object supplied when the was created, or null if none was supplied.
- Returns An that represents the state data that was passed in to the task when it was created.
public static Task CompletedTask { get; }
Gets a task that has already completed successfully.
- Returns The successfully completed task.
public static Nullable<int> CurrentId { get; }
Returns the ID of the currently executing .
- Returns An integer that was assigned by the system to the currently-executing task.
public static Task Delay( int millisecondsDelay )
Creates a task that completes after a specified number of milliseconds.
millisecondsDelayThe number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.- Returns A task that represents the time delay.
public static Task Delay( int millisecondsDelay, CancellationToken cancellationToken )
Creates a cancellable task that completes after a specified number of milliseconds.
millisecondsDelayThe number of milliseconds to wait before completing the returned task, or -1 to wait indefinitely.cancellationTokenA cancellation token to observe while waiting for the task to complete.- Returns A task that represents the time delay.
public static Task Delay( TimeSpan delay )
Creates a task that completes after a specified time interval.
delayThe time span to wait before completing the returned task, or to wait indefinitely.- Returns A task that represents the time delay.
public static Task Delay( TimeSpan delay, CancellationToken cancellationToken )
Creates a cancellable task that completes after a specified time interval.
delayThe time span to wait before completing the returned task, or to wait indefinitely.cancellationTokenA cancellation token to observe while waiting for the task to complete.- Returns A task that represents the time delay.
public AggregateException Exception { get; }
Gets the that caused the to end prematurely. If the completed successfully or has not yet thrown any exceptions, this will return .
- Returns The that caused the to end prematurely.
public static Task<TResult> FromCanceled( CancellationToken cancellationToken )
Creates a that's completed due to cancellation with a specified cancellation token.
cancellationTokenThe cancellation token with which to complete the task.- Returns The canceled task.
public static Task FromCanceled( CancellationToken cancellationToken )
Creates a that's completed due to cancellation with a specified cancellation token.
cancellationTokenThe cancellation token with which to complete the task.- Returns The canceled task.
public static Task<TResult> FromException( Exception exception )
Creates a that has completed with a specified exception.
exceptionThe exception with which to complete the task.- Returns The faulted task.
public static Task FromException( Exception exception )
Creates a that has completed with a specified exception.
exceptionThe exception with which to complete the task.- Returns The faulted task.
public int Id { get; }
Gets an ID for this instance.
- Returns The identifier that is assigned by the system to this instance.
public bool IsCanceled { get; }
Gets whether this instance has completed execution due to being canceled.
- Returns if the task has completed due to being canceled; otherwise .
public bool IsCompleted { get; }
Gets a value that indicates whether the task has completed.
- Returns if the task has completed (that is, the task is in one of the three final states: , , or ); otherwise, .
public bool IsCompletedSuccessfully { get; }
No summary.
public bool IsFaulted { get; }
Gets whether the completed due to an unhandled exception.
- Returns if the task has thrown an unhandled exception; otherwise .
public TaskStatus Status { get; }
Gets the of this task.
- Returns The current of this task instance.
public Task ContinueWith( Action<Task,object> continuationAction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler )
😔 No documentation found.
public static Task Delay( TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken )
😔 No documentation found.
public static Task Delay( TimeSpan delay, TimeProvider timeProvider )
😔 No documentation found.
public TaskAwaiter GetAwaiter( )
😔 No documentation found.
public static Task<TResult> FromResult( TResult result )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,object,TResult> continuationFunction, object state, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,object,TResult> continuationFunction, object state, TaskContinuationOptions continuationOptions )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,object,TResult> continuationFunction, object state, TaskScheduler scheduler )
😔 No documentation found.
public Task ContinueWith( Action<Task> continuationAction, CancellationToken cancellationToken )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,object,TResult> continuationFunction, object state, CancellationToken cancellationToken )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,TResult> continuationFunction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,TResult> continuationFunction, TaskContinuationOptions continuationOptions )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,TResult> continuationFunction, TaskScheduler scheduler )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,TResult> continuationFunction, CancellationToken cancellationToken )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,TResult> continuationFunction )
😔 No documentation found.
public Task ContinueWith( Action<Task> continuationAction )
😔 No documentation found.
public Task ContinueWith( Action<Task,object> continuationAction, object state, TaskContinuationOptions continuationOptions )
😔 No documentation found.
public Task ContinueWith( Action<Task,object> continuationAction, object state, TaskScheduler scheduler )
😔 No documentation found.
public Task ContinueWith( Action<Task,object> continuationAction, object state, CancellationToken cancellationToken )
😔 No documentation found.
public Task ContinueWith( Action<Task,object> continuationAction, object state )
😔 No documentation found.
public Task ContinueWith( Action<Task> continuationAction, CancellationToken cancellationToken, TaskContinuationOptions continuationOptions, TaskScheduler scheduler )
😔 No documentation found.
public Task ContinueWith( Action<Task> continuationAction, TaskContinuationOptions continuationOptions )
😔 No documentation found.
public Task<TResult> ContinueWith( Func<Task,object,TResult> continuationFunction, object state )
😔 No documentation found.
public Task ContinueWith( Action<Task> continuationAction, TaskScheduler scheduler )
😔 No documentation found.