HostLanguageServices Class

Definition

Per-language services provided by the host environment.

C#
public abstract class HostLanguageServices
C#
public abstract class HostLanguageServices : IDisposable
Inheritance
HostLanguageServices
Implements

Remarks

Language services which implement IDisposable are considered ownable, in which case the owner is responsible for disposing of owned instances when they are no longer in use. The ownership rules are described in detail for HostWorkspaceServices. Instances of ILanguageService have the same ownership rules as IWorkspaceService, and instances of ILanguageServiceFactory have the same ownership rules as IWorkspaceServiceFactory.

Constructors

Properties

Language

The name of the language

LanguageServices

Immutable snapshot of the host services. Preferable to use instead of this HostLanguageServices when possible.

WorkspaceServices

The HostWorkspaceServices that originated this language service.

Methods

Dispose()
GetRequiredService<TLanguageService>()

Gets a language specific service provided by the host identified by the service type. If the host does not provide the service, this method returns throws InvalidOperationException.

GetService<TLanguageService>()

Gets a language specific service provided by the host identified by the service type. If the host does not provide the service, this method returns null.

Applies to

Product Versions
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0