Partager via


IVsService<T> Interface

Definition

Provides a mechanism for importing proffered services within an MEF part. This is the MEF equivalent of IAsyncServiceProvider3.

public interface IVsService<T> where T : class
type IVsService<'T (requires 'T : null)> = interface
Public Interface IVsService(Of T)

Type Parameters

T

The service identity of and interface used to interact with the proffered service to retrieve. If T is not registered as async or free-threaded, then this cast will be performed on the main thread.

Derived

Remarks

This interface is safe to access from any thread.

This service acquiring interface is typically acquired via a MEF import attribute. For example: [Import] IVsService<IVsRunningDocumentTable> rdt;

When the service identity and interface are distinct types, use IVsService<TService,TInterface> instead.

Methods

GetValueAsync(CancellationToken)

Retrieves a proffered service asynchronously, throwing an exception if it could not be retrieved.

GetValueOrNullAsync(CancellationToken)

Retrieves a proffered service asynchronously; otherwise, null if it could not be retrieved.

Applies to