ThreadHelper.Invoke<TResult> Method (Func)
Evaluates a function on the UI thread.
Namespace: Microsoft.VisualStudio.Shell
Assembly: Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)
Syntax
'宣告
Public Function Invoke(Of TResult) ( _
method As Func<(Of <<'(UMP>)>>) _
) As TResult
public TResult Invoke<TResult>(
Func<(Of <<'(UMP>)>>) method
)
Type Parameters
- TResult
The type of the function evaluation result.
Parameters
- method
Type: System.Func<UMP>
The method to evaluate on the UI thread.
Return Value
Type: TResult
The result of the given type.
Remarks
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.