共用方式為


ThreadingTools Class

Utility methods for working across threads.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Threading.ThreadingTools

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

Syntax

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

The ThreadingTools type exposes the following members.

Methods

  Name Description
Public methodStatic member Apply Applies the specified SynchronizationContext to the caller's context.
Public methodStatic member ApplyChangeOptimistically<T>
Public methodStatic member WithCancellation(Task, CancellationToken) Wraps a task with one that will complete as cancelled based on a cancellation token, allowing someone to await a task but be able to break out early by cancelling the token.
Public methodStatic member WithCancellation<T>(Task<T>, CancellationToken)

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