Open sandboxFocus

Method AddOrApplyChanges

AddOrApplyChanges(TValue)

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of adding an item, or merging it with an existing item if the same key already exists.

Declaration
public IncrementalKeyedCollection<TKey, TValue> AddOrApplyChanges(TValue item)
Parameters
Type Name Description
TValue item

The item to add or merge.

Returns
Type Description
IncrementalKeyedCollection<TKey, TValue>

A new IncrementalKeyedCollection<TKey, TValue> with the additional operation.

Remarks

This method does not modify the current instance; it returns a new instance with the combined operations. If an item with the same key exists in the current layer, the items are merged using ApplyChanges(object, in ApplyChangesContext).

AddOrApplyChanges(params TValue[])

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of adding items, or merging them with existing items if the same keys already exist.

Declaration
public IncrementalKeyedCollection<TKey, TValue> AddOrApplyChanges(params TValue[] items)
Parameters
Type Name Description
TValue[] items

The items to add or merge.

Returns
Type Description
IncrementalKeyedCollection<TKey, TValue>

A new IncrementalKeyedCollection<TKey, TValue> with the additional operations.

Remarks

This method does not modify the current instance; it returns a new instance with the combined operations. For each item, if an item with the same key exists in the current layer, the items are merged using ApplyChanges(object, in ApplyChangesContext).

AddOrApplyChanges(IEnumerable<TValue>)

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of adding items, or merging them with existing items if the same keys already exist.

Declaration
public IncrementalKeyedCollection<TKey, TValue> AddOrApplyChanges(IEnumerable<TValue> items)
Parameters
Type Name Description
IEnumerable<TValue> items

The items to add or merge.

Returns
Type Description
IncrementalKeyedCollection<TKey, TValue>

A new IncrementalKeyedCollection<TKey, TValue> with the additional operations.

Remarks

This method does not modify the current instance; it returns a new instance with the combined operations. For each item, if an item with the same key exists in the current layer, the items are merged using ApplyChanges(object, in ApplyChangesContext).