Share via


IVsDataHostService.TryGetService Method

Definition

Overloads

TryGetService<T>()

Tries to get a global Visual Studio service of the specified type.

TryGetService<T>(Guid)

Tries to get a global Visual Studio service that is registered with the specified class ID that implements the specified interface.

TryGetService<TService,TInterface>()

Tries to get a global Visual Studio service of the specified type that implements the specified interface.

TryGetService<T>()

Tries to get a global Visual Studio service of the specified type.

public:
generic <typename T>
 T TryGetService();
public T TryGetService<T> ();
abstract member TryGetService : unit -> 'T
Public Function TryGetService(Of T) () As T

Type Parameters

T

The type.

Returns

T

The service instance, if found; otherwise, null.

Applies to

TryGetService<T>(Guid)

Tries to get a global Visual Studio service that is registered with the specified class ID that implements the specified interface.

public:
generic <typename T>
 T TryGetService(Guid serviceGuid);
public T TryGetService<T> (Guid serviceGuid);
abstract member TryGetService : Guid -> 'T
Public Function TryGetService(Of T) (serviceGuid As Guid) As T

Type Parameters

T

The interface.

Parameters

serviceGuid
Guid

The class ID of the service to retrieve.

Returns

T

The service instance, if found; otherwise, null.

Applies to

TryGetService<TService,TInterface>()

Tries to get a global Visual Studio service of the specified type that implements the specified interface.

public:
generic <typename TService, typename TInterface>
 TInterface TryGetService();
public TInterface TryGetService<TService,TInterface> ();
abstract member TryGetService : unit -> 'Interface
Public Function TryGetService(Of TService, TInterface) () As TInterface

Type Parameters

TService

The service.

TInterface

The type.

Returns

TInterface

The service instance, if found; otherwise, null.

Applies to