OleServiceProvider.AddService Method (Type, OleServiceProvider.ServiceCreatorCallback, 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, _
    callback As OleServiceProvider..::.ServiceCreatorCallback, _
    shouldDisposeServiceInstance As Boolean _
)
'使用
Dim instance As OleServiceProvider
Dim serviceType As Type
Dim callback As OleServiceProvider..::.ServiceCreatorCallback
Dim shouldDisposeServiceInstance As Boolean

instance.AddService(serviceType, callback, _
    shouldDisposeServiceInstance)
public void AddService(
    Type serviceType,
    OleServiceProvider..::.ServiceCreatorCallback callback,
    bool shouldDisposeServiceInstance
)
public:
void AddService(
    Type^ serviceType, 
    OleServiceProvider..::.ServiceCreatorCallback^ callback, 
    bool shouldDisposeServiceInstance
)
public function AddService(
    serviceType : Type, 
    callback : OleServiceProvider..::.ServiceCreatorCallback, 
    shouldDisposeServiceInstance : boolean
)

Parameters

  • serviceType
    Type: System.Type

    The type 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