Open sandboxFocus

Interface IIncrementalObject

A base interface for all classes whose individual instances represent incremental changes that can be combined with the ApplyChanges(object, in ApplyChangesContext) method.

Namespace: Metalama.Framework.Options
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IIncrementalObject
Remarks

This interface is the foundation of Metalama's options system. Classes implementing IIncrementalObject represent layers of changes rather than complete states. When multiple layers are combined using ApplyChanges(object, in ApplyChangesContext), they are merged to produce a final effective configuration.

Implementations must be immutable. Each instance should only store the properties that are explicitly being changed, with all other properties typically set to null or an equivalent "unset" state. When ApplyChanges(object, in ApplyChangesContext) is called, properties from the changes parameter override properties from the current instance, but only if they are set (i.e., non-null or otherwise marked as "set").

The most common implementation of this interface is IHierarchicalOptions, which is used for aspect configuration. Additionally, specialized collection types like IncrementalHashSet<T> and IncrementalKeyedCollection<TKey, TValue> implement this interface to support incremental modifications of collections within options.

Methods

Name Description
ApplyChanges(object, in ApplyChangesContext)

Returns an object where the properties of the current object are overwritten or complemented by the properties of another given object, but only for properties that are set in the changes object.

Extension Methods

See Also