Share via


ServiceProvider.AddService Method (Type, ServiceCreatorCallback)

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

'Declaration
Public Sub AddService ( _
    serviceType As Type, _
    callback As ServiceCreatorCallback _
)
public void AddService(
    Type serviceType,
    ServiceCreatorCallback callback
)
public:
virtual void AddService(
    Type^ serviceType, 
    ServiceCreatorCallback^ callback
) sealed
abstract AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback -> unit  
override AddService : 
        serviceType:Type * 
        callback:ServiceCreatorCallback -> unit
public final function AddService(
    serviceType : Type, 
    callback : ServiceCreatorCallback
)

Parameters

  • serviceType
    Type: System.Type

    The type of the service to add.

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.

.NET Framework Security

See Also

Reference

ServiceProvider Class

AddService Overload

Microsoft.VisualStudio.Data.Framework Namespace