ServiceProvider.GetService Method (Type)

Retrieves a service of the specified type.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'宣言
Public Function GetService ( _
    serviceType As Type _
) As Object
'使用
Dim instance As ServiceProvider
Dim serviceType As Type
Dim returnValue As Object

returnValue = instance.GetService(serviceType)
public Object GetService(
    Type serviceType
)
public:
virtual Object^ GetService(
    Type^ serviceType
) sealed
public final function GetService(
    serviceType : Type
) : Object

Parameters

Return Value

Type: System.Object

Returns the service of the specified type, or returns a null reference (Nothing in Visual Basic) if no service was found.

Implements

IServiceProvider.GetService(Type)

Remarks

The behavior of this method differs depending on the purpose of the IServiceProvider instance. When this object is providing a service provider, it delegates to the GetServiceImpl method. When this object is wrapping an unmanaged service provider, it gets the GUID of the type and delegates to the GetService method.

Permissions

See Also

Reference

ServiceProvider Class

ServiceProvider Members

GetService Overload

Microsoft.VisualStudio.Data Namespace