Adds the specified service to the internal collection of services.
Namespace: Microsoft.VisualStudio.Data.Framework
Assembly: Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.dll)
Syntax
'宣言
Public Sub AddService ( _
serviceType As Type, _
callback As ServiceCreatorCallback _
)
'使用
Dim instance As ServiceProvider
Dim serviceType As Type
Dim callback As ServiceCreatorCallback
instance.AddService(serviceType, callback)
public void AddService(
Type serviceType,
ServiceCreatorCallback callback
)
public:
virtual void AddService(
Type^ serviceType,
ServiceCreatorCallback^ callback
) sealed
public final function AddService(
serviceType : Type,
callback : ServiceCreatorCallback
)
Parameters
serviceType
Type: System.TypeThe type of the service to add.
callback
Type: System.ComponentModel.Design.ServiceCreatorCallbackA callback object that is used to create the service.
Implements
IServiceContainer.AddService(Type, ServiceCreatorCallback)
Remarks
The callback parameter allows a service to be declared as available but delays the creation of the object until the service is requested.
This method calls AddService.
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.