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.TypeThe type of the service.
serviceInstance
Type: System.ObjectAn instance of the service.
shouldDisposeServiceInstance
Type: System.BooleanTrue 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.