Share via


AwaitExtensions.SwitchTo Method

Gets an awaitable that schedules continuations on the specified scheduler.

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function SwitchTo ( _
    scheduler As TaskScheduler, _
    alwaysYield As Boolean _
) As AwaitExtensions.TaskSchedulerAwaitable
public static AwaitExtensions.TaskSchedulerAwaitable SwitchTo(
    this TaskScheduler scheduler,
    bool alwaysYield
)
[ExtensionAttribute]
public:
static AwaitExtensions::TaskSchedulerAwaitable SwitchTo(
    TaskScheduler^ scheduler, 
    bool alwaysYield
)
static member SwitchTo : 
        scheduler:TaskScheduler * 
        alwaysYield:bool -> AwaitExtensions.TaskSchedulerAwaitable
public static function SwitchTo(
    scheduler : TaskScheduler, 
    alwaysYield : boolean
) : AwaitExtensions.TaskSchedulerAwaitable

Parameters

  • alwaysYield
    Type: System.Boolean

    A value indicating whether the caller should yield even if already executing on the desired task scheduler.

Return Value

Type: Microsoft.VisualStudio.Threading.AwaitExtensions.TaskSchedulerAwaitable
Returns AwaitExtensions.TaskSchedulerAwaitable.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type TaskScheduler. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

.NET Framework Security

See Also

Reference

AwaitExtensions Class

Microsoft.VisualStudio.Threading Namespace