WorkspaceServiceHelper.GetServiceAsync<T>(IWorkspace, Boolean) Method

Definition

Get a service type from a workspace using the async pattern

public static System.Threading.Tasks.Task<T> GetServiceAsync<T> (this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;
public static System.Threading.Tasks.Task<T?> GetServiceAsync<T> (this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;
static member GetServiceAsync : Microsoft.VisualStudio.Workspace.IWorkspace * bool -> System.Threading.Tasks.Task<'T (requires 'T : null)> (requires 'T : null)
<Extension()>
Public Function GetServiceAsync(Of T As Class) (workspace As IWorkspace, Optional throwIfNotFound As Boolean = false) As Task(Of T)

Type Parameters

T

Type of the service to ask for

Parameters

workspace
IWorkspace

The workspace context

throwIfNotFound
Boolean

Throw exception if service not found

Returns

Task<T>

The workspace service or null if not found

Applies to