ThreadHelper.Invoke<TResult> Method (Func<TResult>)

 

Evaluate a function on the UI thread.

Namespace:   Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)

[DebuggerStepThroughAttribute]
public TResult Invoke<TResult>(
	Func<TResult> method
)

Parameters

method
Type: System.Func<TResult>

The function to evaluate on the UI thread.

Return Value

Type: TResult

Returns the result of the specified function evaluation.

Type Parameters

TResult

The type of the function evaluation result.

If the caller is already on the UI thread, then the call is made directly. Otherwise, the call is transferred onto the UI thread, and this thread blocks until the call returns. If the UI thread throws an exception, that exception is transferred and thrown again on this thread.

Return to top
Show: