Compartir a través de


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

'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

Return Value

Type: System.Object
Returns the service of the specified type, or returns nulla 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.

.NET Framework Security

See Also

Reference

ServiceProvider Class

GetService Overload

Microsoft.VisualStudio.Data Namespace