共用方式為


Package.IServiceContainer.AddService Method (Type, ServiceCreatorCallback)

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, _
    callback As ServiceCreatorCallback _
) Implements IServiceContainer.AddService
'用途
Dim instance As Package
Dim serviceType As Type
Dim callback As ServiceCreatorCallback

CType(instance, IServiceContainer).AddService(serviceType, _
    callback)
void IServiceContainer.AddService(
    Type serviceType,
    ServiceCreatorCallback callback
)
private:
virtual void AddService(
    Type^ serviceType, 
    ServiceCreatorCallback^ callback
) sealed = IServiceContainer::AddService
private abstract AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback -> unit 
private override AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback -> unit 
JScript does not support explicit interface implementations.

Parameters

  • serviceType
    Type: System.Type
    Type of service to add.

Implements

IServiceContainer.AddService(Type, ServiceCreatorCallback)

.NET Framework Security

See Also

Reference

Package Class

Package Members

AddService Overload

Microsoft.VisualStudio.Shell Namespace