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

Definition

Get a service type from a workspace using the async pattern

C#
public static System.Threading.Tasks.Task<T> GetServiceAsync<T>(this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;
C#
public static System.Threading.Tasks.Task<T?> GetServiceAsync<T>(this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;

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

Proizvod Verzije
Visual Studio SDK 2017, 2019, 2022