Partager via


IVsService<TService,TInterface> Interface

Definition

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

public interface IVsService<TService,TInterface> : Microsoft.VisualStudio.IVsService<TInterface> where TService : class where TInterface : class
type IVsService<'Service, 'Interface (requires 'Service : null and 'Interface : null)> = interface
    interface IVsService<'Interface (requires 'Interface : null)>
Public Interface IVsService(Of TService, TInterface)
Implements IVsService(Of TInterface)

Type Parameters

TService

The service identity of the proffered service to import.

TInterface

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

Implements
IVsService<TInterface>

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<SVsRunningDocumentTable, IVsRunningDocumentTable> rdt;

When TService and TInterface are the same type, the IVsService<T> interface is a simpler option.

Methods

GetValueAsync(CancellationToken)

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

(Inherited from IVsService<T>)
GetValueOrNullAsync(CancellationToken)

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

(Inherited from IVsService<T>)

Applies to