ModelOptionsCloneExtensions

Helpers & Utilities · AiDotNet.Models

Cloning for options classes.

For Beginners

options.Clone() gives you a separate copy you can change without affecting the original — useful for running the same model with one setting varied. You do not have to write anything to make this work on your own options class: inherit from an options base class and cloning is already correct.

How It Works

Offered as an extension rather than a virtual method so that the return type is the caller’s own type. myOptions.Clone() yields MyOptions, not the abstract base, without every options class having to override anything or the base class needing a self-referencing type parameter that would show up in every derived signature.

Methods

Method Summary
T Clone(T source, CloneOptions options) Creates an independent copy of an options instance.