FromCurrentSynchronizationContext Method

Task Parallel System.Threading

Creates a TaskScheduler associated with the current SynchronizationContext.

Namespace:  System.Threading.Tasks
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function FromCurrentSynchronizationContext As TaskScheduler
C#
public static TaskScheduler FromCurrentSynchronizationContext()

Return Value

A TaskScheduler associated with the current SynchronizationContext, as determined by SynchronizationContext.Current.

Remarks

All Task instances queued to the returned scheduler will be executed through a call to the Post method on that context.

Exceptions

ExceptionCondition
System..::.InvalidOperationException The current SynchronizationContext may not be used as a TaskScheduler.

See Also