Kernel.Clone Method

Definition

Clone the Kernel object to create a new instance that may be mutated without affecting the current instance.

public Microsoft.SemanticKernel.Kernel Clone();
member this.Clone : unit -> Microsoft.SemanticKernel.Kernel
Public Function Clone () As Kernel

Returns

Remarks

The current instance is unmodified by this operation. The new Kernel will be initialized with:

  • The same IServiceProvider reference as is returned by the current instance's Services.
  • A new KernelPluginCollection instance initialized with the same KernelPlugin instances as are stored by the current instance's Plugins collection. Changes to the new instance's plugin collection will not affect the current instance's plugin collection, and vice versa.
  • All of the delegates registered with each event. Delegates are immutable (every time an additional delegate is added or removed, a new one is created), so changes to the new instance's event delegates will not affect the current instance's event delegates, and vice versa.
  • A new IDictionary<TKey,TValue> containing all of the key/value pairs from the current instance's Data dictionary. Any changes made to the new instance's dictionary will not affect the current instance's dictionary, and vice versa.
  • The same CultureInfo reference as is returned by the current instance's Culture.

Applies to