WorkspaceServiceHelper.GetService<T>(IWorkspace, Boolean) Method
Definition
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
public static T GetService<T> (this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;
public static T? GetService<T> (this Microsoft.VisualStudio.Workspace.IWorkspace workspace, bool throwIfNotFound = false) where T : class;
static member GetService : Microsoft.VisualStudio.Workspace.IWorkspace * bool -> 'T (requires 'T : null)
<Extension()>
Public Function GetService(Of T As Class) (workspace As IWorkspace, Optional throwIfNotFound As Boolean = false) As 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
T
The workspace service or null if not found