DelegateTask..::..CallBack delegate that is called in IDispatcher thread. Usually used in synchronization with GUI thread.
Namespace: Dapfor.Net.ThreadingAssembly: Dapfor.Net (in Dapfor.Net.dll) Version: 2.10.3.24917 (2.10.3.24917)
Syntax
C# |
---|
public delegate void CallBack() |
Visual Basic |
---|
Public Delegate Sub CallBack |
Visual C++ |
---|
public delegate void CallBack() |
F# |
---|
type CallBack = delegate of unit -> unit |
Remarks
Following example demonstrates how to synchronize threads via anonymous method
Copy | |
---|---|
private void WriteDataToConsole(object data) { if (dispatcher.SynchronizationRequired) { //Create a task that will be executed in dispatcher thread without blocking the calling thread dispatcher.Dispatch(new DelegateTask(delegate { Console.WriteLine("Called in the anonymous method: object = {0}", data); })); } else { Console.WriteLine("No synchronization required: object = {0}", data); } } |