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
scheduler
Type: System.Threading.Tasks.TaskSchedulerThe task scheduler used to execute continuations.
alwaysYield
Type: System.BooleanA 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.