Package.IServiceContainer.AddService Method (Type, Object, Boolean)
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Adds the given service to the VSPackage's service container.
Namespace: Microsoft.VisualStudio.Shell
Assemblies: Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)
Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
Syntax
声明
Private Sub AddService ( _
serviceType As Type, _
serviceInstance As Object, _
promote As Boolean _
) Implements IServiceContainer.AddService
用法
Dim instance As Package
Dim serviceType As Type
Dim serviceInstance As Object
Dim promote As Boolean
CType(instance, IServiceContainer).AddService(serviceType, _
serviceInstance, promote)
void IServiceContainer.AddService(
Type serviceType,
Object serviceInstance,
bool promote
)
private:
virtual void AddService(
Type^ serviceType,
Object^ serviceInstance,
bool promote
) sealed = IServiceContainer::AddService
private abstract AddService :
serviceType:Type *
serviceInstance:Object *
promote:bool -> unit
private override AddService :
serviceType:Type *
serviceInstance:Object *
promote:bool -> unit
JScript does not support explicit interface implementations.
Parameters
- serviceType
Type: System.Type
Type of service to add.
- serviceInstance
Type: System.Object
Service object.
- promote
Type: System.Boolean
true if this service should be added to any parent service containers; otherwise, false.
Implements
IServiceContainer.AddService(Type, Object, Boolean)
.NET Framework Security
- 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.