Provides a callback mechanism that can create an instance of a service on demand.
Assembly: System (in System.dll)
[ComVisibleAttribute(true)] [HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)] public delegate Object ServiceCreatorCallback( IServiceContainer container, Type serviceType )
- Type: System.ComponentModel.Design.IServiceContainer
The service container that requested the creation of the service.
- Type: System.Type
The type of service to create.
Return ValueType: System.Object
The service specified by serviceType, or null if the service could not be created.
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: SharedState. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
provides a mechanism to publish services that you can request to have created when needed, rather than the service being created immediately when the designer loads. You can use a callback function if the service is not essential and may not be used. A service published by using a does not use as many additional resources if it is not requested and created. To use a callback function to publish your service, pass a to the AddService method of an IServiceContainer.
The following code example shows how to publish a service using a callback function.
// The following code shows how to publish a service using a callback function. // Creates a service creator callback. ServiceCreatorCallback callback1 = new ServiceCreatorCallback(myCallBackMethod); // Adds the service using its type and the service creator callback. serviceContainer.AddService(typeof(myService), callback1);
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.