共用方式為


PackageUtilities.QueryService Method

Definition

Overloads

QueryService(IServiceProvider, Guid)

Gets a service exposed by a service provider based on its service GUID.

QueryService<TService>(IServiceProvider)

Gets a service exposed by a service provider based on its service type.

QueryService(IServiceProvider, Guid)

Gets a service exposed by a service provider based on its service GUID.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ QueryService(Microsoft::VisualStudio::OLE::Interop::IServiceProvider ^ serviceProvider, Guid serviceGuid);
public static object QueryService (this Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider, Guid serviceGuid);
static member QueryService : Microsoft.VisualStudio.OLE.Interop.IServiceProvider * Guid -> obj
<Extension()>
Public Function QueryService (serviceProvider As IServiceProvider, serviceGuid As Guid) As Object

Parameters

serviceProvider
IServiceProvider

The service provider to query.

serviceGuid
Guid

The service GUID.

Returns

The service, if found; otherwise null.

Applies to

QueryService<TService>(IServiceProvider)

Gets a service exposed by a service provider based on its service type.

public:
generic <typename TService>
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ QueryService(Microsoft::VisualStudio::OLE::Interop::IServiceProvider ^ serviceProvider);
public:
generic <typename TService>
[System::Runtime::CompilerServices::Extension]
 static Platform::Object ^ QueryService(Microsoft::VisualStudio::OLE::Interop::IServiceProvider ^ serviceProvider);
public static object QueryService<TService> (this Microsoft.VisualStudio.OLE.Interop.IServiceProvider serviceProvider);
static member QueryService : Microsoft.VisualStudio.OLE.Interop.IServiceProvider -> obj
<Extension()>
Public Function QueryService(Of TService) (serviceProvider As IServiceProvider) As Object

Type Parameters

TService

The type whose GuidAttribute specifies the service GUID to query for.

Parameters

serviceProvider
IServiceProvider

The service provider to query.

Returns

The service, if found; otherwise null.

Applies to