共用方式為


TplExtensions Class

Extensions to the Task Parallel Library.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Threading.TplExtensions

Namespace:  Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public NotInheritable Class TplExtensions
public static class TplExtensions
[ExtensionAttribute]
public ref class TplExtensions abstract sealed
[<AbstractClass>]
[<Sealed>]
type TplExtensions =  class end
public final class TplExtensions

The TplExtensions type exposes the following members.

Methods

  Name Description
Public methodStatic member AppendAction Schedules some action for execution at the conclusion of a task.
Public methodStatic member ApplyResultTo<T>(Task, TaskCompletionSource<T>)
Public methodStatic member ApplyResultTo<T>(Task<T>, TaskCompletionSource<T>)
Public methodStatic member AttachToParent(Task) Creates a task that is attached to the parent task, but produces the same result as an existing task.
Public methodStatic member AttachToParent<T>(Task<T>)
Public methodStatic member FollowCancelableTaskToCompletion<T>
Public methodStatic member Forget Consumes a task and doesn't do anything with it. Useful for fire-and-forget calls to asynchronous methods within asynchronous methods.
Public methodStatic member InvokeAsync(AsyncEventHandler, Object, EventArgs) Invokes asynchronous event handlers, returning a task that completes when all event handlers have been invoked. Each handler is fully executed (including continuations) before the next handler in the list is invoked.
Public methodStatic member InvokeAsync<TEventArgs>(AsyncEventHandler<TEventArgs>, Object, TEventArgs) Invokes asynchronous event handlers, returning a task that completes when all event handlers have been invoked. Each handler is fully executed (including continuations) before the next handler in the list is invoked.
Public methodStatic member NoThrowAwaitable Returns an awaitable for the specified task that will never throw, even if the source task faults or is canceled.
Public methodStatic member ToApm(Task, AsyncCallback, Object) Converts a TPL task to the Asynchronous Programming Model (APM) Begin-End pattern.
Public methodStatic member ToApm<TResult>(Task<TResult>, AsyncCallback, Object)
Public methodStatic member WaitWithoutInlining Wait on a task without possibly inlining it to the current thread.

Top

Fields

  Name Description
Public fieldStatic member CanceledTask A task that is already canceled.
Public fieldStatic member CompletedTask A singleton completed task.
Public fieldStatic member FalseTask A completed task with a false result.
Public fieldStatic member TrueTask A completed task with a true result.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Threading Namespace