OleServiceProvider.AddService Method (Type, Object, Boolean)

Adds a service of the specified type to the internal collection.

Namespace:  Microsoft.VisualStudio.Package
Assembly:  MPF.Project.NonShipping (in MPF.Project.NonShipping.dll)

Syntax

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

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

Parameters

  • serviceType
    Type: System.Type

    The type of the service.

  • serviceInstance
    Type: System.Object

    An instance of the service.

  • shouldDisposeServiceInstance
    Type: System.Boolean

    True if the service implements IDisposable and should be disposed on removal.

Remarks

This method adds only services that will be unique in the collection.

Permissions

See Also

Reference

OleServiceProvider Class

OleServiceProvider Members

AddService Overload

Microsoft.VisualStudio.Package Namespace