WorkspaceServiceHelper.GetServiceAsync<T>(IWorkspace, Boolean) Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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;
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)
- T
Type of the service to ask for
- workspace
- IWorkspace
The workspace context
- throwIfNotFound
- Boolean
Throw exception if service not found
Task<T>
The workspace service or null if not found
Proizvod | Verzije |
---|---|
Visual Studio SDK | 2017, 2019, 2022 |