Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Dispatcher.Yield Method ()

.NET Framework (current version)
 

Creates an awaitable object that asynchronously yields control back to the current dispatcher and provides an opportunity for the dispatcher to process other events.

Namespace:   System.Windows.Threading
Assembly:  WindowsBase (in WindowsBase.dll)

public static DispatcherPriorityAwaitable Yield()

Return Value

Type: System.Windows.Threading.DispatcherPriorityAwaitable

An awaitable object that asynchronously yields control back to the current dispatcher and provides an opportunity for the dispatcher to process other events.

This method provides a way for you to temporarily release execution control to the current dispatcher so it can do other work, such as process other events. Use the await, or Await in Visual Basic, operator on the return value to return control to the current dispatcher. Use this method if want to give your app a chance to process events while you app is doing a lot of work on the UI thread. For example, you can use this method in a long-running loop that updates a control.

This method is equivalent to calling the Yield(DispatcherPriority) method and passing in DispatcherPriority.Background.

.NET Framework
Available since 4.5
Return to top
Show:
© 2016 Microsoft