ServiceProvider.AddService Method (Type, Object, Boolean)

Adds the specified service to the collection of service objects or to the parent service container.

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

Syntax

'宣言
Public Overridable Sub AddService ( _
    serviceType As Type, _
    serviceInstance As Object, _
    promote As Boolean _
)
'使用
Dim instance As ServiceProvider
Dim serviceType As Type
Dim serviceInstance As Object
Dim promote As Boolean

instance.AddService(serviceType, serviceInstance, _
    promote)
public virtual void AddService(
    Type serviceType,
    Object serviceInstance,
    bool promote
)
public:
virtual void AddService(
    Type^ serviceType, 
    Object^ serviceInstance, 
    bool promote
)
public function AddService(
    serviceType : Type, 
    serviceInstance : Object, 
    promote : boolean
)

Parameters

  • serviceType
    Type: System.Type

    The type of the service to add.

  • promote
    Type: System.Boolean

    A Boolean value indicating whether to add the service to the parent container.

Implements

IServiceContainer.AddService(Type, Object, Boolean)

Permissions

See Also

Reference

ServiceProvider Class

ServiceProvider Members

AddService Overload

Microsoft.VisualStudio.Data.Framework Namespace