共用方式為


HostWorkspaceServices.GetRequiredService<TWorkspaceService> 方法

定義

取得服務類型所識別的主機所提供的工作區特定服務。 如果主機未提供服務,這個方法會擲回 InvalidOperationException

public:
generic <typename TWorkspaceService>
 where TWorkspaceService : Microsoft::CodeAnalysis::Host::IWorkspaceService TWorkspaceService GetRequiredService();
public TWorkspaceService GetRequiredService<TWorkspaceService> () where TWorkspaceService : Microsoft.CodeAnalysis.Host.IWorkspaceService;
member this.GetRequiredService : unit -> 'WorkspaceService (requires 'WorkspaceService :> Microsoft.CodeAnalysis.Host.IWorkspaceService)
Public Function GetRequiredService(Of TWorkspaceService As IWorkspaceService) () As TWorkspaceService

類型參數

TWorkspaceService

傳回

TWorkspaceService

例外狀況

主機不提供服務。

適用於