Open sandboxFocus

Method ApplyChanges

ApplyChanges(IncrementalKeyedCollection<TKey, TValue>, in ApplyChangesContext)

Merges the current collection layer with another collection layer and returns the result.

Declaration
public IncrementalKeyedCollection<TKey, TValue> ApplyChanges(IncrementalKeyedCollection<TKey, TValue> overridingOptions, in ApplyChangesContext context)
Parameters
Type Name Description
IncrementalKeyedCollection<TKey, TValue> overridingOptions

The collection layer to merge with the current layer.

ApplyChangesContext context

The context of the merge operation.

Returns
Type Description
IncrementalKeyedCollection<TKey, TValue>

A new IncrementalKeyedCollection<TKey, TValue> representing the merged result.

Remarks

If overridingOptions contains a clear operation, it takes precedence and the result contains only the operations from overridingOptions. Otherwise, items from both layers are combined. When an item with the same key exists in both layers and both are enabled (not marked for removal), the two item instances are themselves merged using ApplyChanges(object, in ApplyChangesContext). In all other cases (removal operations, or item present in only one layer), the operation from overridingOptions takes precedence if it defines that key.