.NET Framework Class Library |
TaskScheduler..::.FromCurrentSynchronizationContext Method |
TaskScheduler Class See Also Send Feedback |
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
Exception | Condition |
---|---|
System..::.InvalidOperationException | The current SynchronizationContext may not be used as a TaskScheduler. |