ServiceCreatorCallback Delegato
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Fornisce un meccanismo di callback che consente la creazione di un'istanza di un servizio su richiesta.
public delegate System::Object ^ ServiceCreatorCallback(IServiceContainer ^ container, Type ^ serviceType);
public delegate object ServiceCreatorCallback(IServiceContainer container, Type serviceType);
public delegate object? ServiceCreatorCallback(IServiceContainer container, Type serviceType);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate object ServiceCreatorCallback(IServiceContainer container, Type serviceType);
type ServiceCreatorCallback = delegate of IServiceContainer * Type -> obj
[<System.Runtime.InteropServices.ComVisible(true)>]
type ServiceCreatorCallback = delegate of IServiceContainer * Type -> obj
Public Delegate Function ServiceCreatorCallback(container As IServiceContainer, serviceType As Type) As Object
- container
- IServiceContainer
Contenitore dei servizi che ha richiesto la creazione del servizio.
- serviceType
- Type
Tipo di servizio da creare.
Il servizio specificato da serviceType
oppure null
se non è stato possibile creare il servizio.
- Attributi
Nell'esempio di codice seguente viene illustrato come pubblicare un servizio usando una funzione di callback.
// The following code shows how to publish a service using a callback function.
// Creates a service creator callback.
ServiceCreatorCallback^ callback1 =
gcnew ServiceCreatorCallback( this, &Sample::myCallBackMethod );
// Adds the service using its type and the service creator callback.
serviceContainer->AddService( myService::typeid, callback1 );
// 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);
' The following code shows how to publish a service using a callback function.
' Creates a service creator callback.
Dim callback1 As New ServiceCreatorCallback _
(AddressOf myCallBackMethod)
' Adds the service using its type and the service creator.
serviceContainer.AddService(GetType(myService), callback1)
ServiceCreatorCallback fornisce un meccanismo per pubblicare i servizi che è possibile richiedere di aver creato quando necessario, anziché il servizio creato immediatamente quando la finestra di progettazione viene caricata. È possibile usare una funzione di callback se il servizio non è essenziale e potrebbe non essere usato. Un servizio pubblicato tramite un ServiceCreatorCallback oggetto non usa quante risorse aggiuntive se non è richiesto e creato. Per usare una funzione di callback per pubblicare il AddService servizio, passare un ServiceCreatorCallback al metodo di un IServiceContaineroggetto .
Get |
Ottiene un oggetto che rappresenta il metodo rappresentato dal delegato specificato. |
Prodotto | Versioni |
---|---|
.NET | Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto open source. Seleziona un collegamento per fornire feedback: