Dispatcher.BeginInvoke Method (Delegate, Object[])
Executes the specified delegate asynchronously with the specified array of arguments on the thread the Dispatcher is associated with.
Namespace: System.Windows.Threading
Assembly: System.Windows (in System.Windows.dll)
Parameters
- d
- Type: System.Delegate
A delegate to a method that takes multiple arguments, which is pushed onto the Dispatcher event queue.
- args
- Type: System.Object[]
An array of objects to pass as arguments to the specified method.
Return Value
Type: System.Windows.Threading.DispatcherOperationAn object, which is returned immediately after BeginInvoke is called, that represents the operation that has been posted to the Dispatcher queue.
The following code example demonstrates how to use this method.
private delegate void AddTextDelegate(Panel p, String text); private void AddText(Panel p, String text) { p.Children.Clear(); p.Children.Add(new TextBlock { Text = text }); } private void TestBeginInvokeWithParameters(Panel p) { if (p.Dispatcher.CheckAccess()) AddText(p, "Added directly."); else p.Dispatcher.BeginInvoke( new AddTextDelegate(AddText), p, "Added by Dispatcher."); }
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.