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

Definition

Get a service type from a workspace

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

Applies to