共用方式為


ServiceProviderHierarchy.GetService Method

Gets a service of the specified type.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.12.0 (in Microsoft.VisualStudio.Shell.12.0.dll)

Syntax

'Declaration
Public Function GetService ( _
    serviceType As Type _
) As Object
public Object GetService(
    Type serviceType
)
public:
virtual Object^ GetService(
    Type^ serviceType
) sealed
abstract GetService : 
        serviceType:Type -> Object  
override GetService : 
        serviceType:Type -> Object
public final function GetService(
    serviceType : Type
) : Object

Parameters

  • serviceType
    Type: Type

    The type of the service.

Return Value

Type: Object
The requested service, or null if the service cannot be found. This service must be cast to the required service type.

Implements

IServiceProvider.GetService(Type)

Remarks

This method walks the hierarchy of services to find the requested service.

.NET Framework Security

See Also

Reference

ServiceProviderHierarchy Class

Microsoft.VisualStudio.Shell Namespace