Creates a new Task for the target Dispatcher (default: the main Dispatcher) based upon the given function. This method will wait for the task completion or the timeout and returns the return value.

Namespace: UnityThreading
Assembly: UnityThreading (in UnityThreading.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

C#
public T DispatchAndWait<T>(
	Func<T> function,
	float timeOutSeconds
)
Visual Basic
Public Function DispatchAndWait(Of T) ( _
	function As Func(Of T), _
	timeOutSeconds As Single _
) As T
Visual C++
public:
generic<typename T>
T DispatchAndWait(
	Func<T>^ function, 
	float timeOutSeconds
)

Parameters

function
Type: System..::..Func<(Of <(<'T>)>)>
The function to process at the dispatchers thread.
timeOutSeconds
Type: System..::..Single
Time in seconds after the waiting process will stop.

Type Parameters

T
The return value of the task.

Return Value

The return value of the tasks function.

See Also