MetalamaAPI documentationAspect APIMetalama.​Framework.​OptionsIncremental­Keyed­Collection<TKey, TValue>
Open sandboxFocus

IncrementalKeyedCollection<TKey, TValue> Class

An immutable keyed collection where each class instance does not represent the full collection but a modification of another collection (possibly empty). This class implements the IIncrementalObject interface and can be easily used in the context of an IHierarchicalOptions<T>. The class can represent the AddOrApplyChanges(TValue), Remove(TKey) and Clear<TKey, TValue>() operations.

Inheritance
IncrementalKeyedCollection<TKey, TValue>
Namespace: Metalama.Framework.Options
Assembly: Metalama.Framework.dll
Syntax
public class IncrementalKeyedCollection<TKey, TValue> : Object, IIncrementalObject, ICompileTimeSerializable where TValue : class, IIncrementalKeyedCollectionItem<TKey>
Type Parameters
Name Description
TKey

Type of keys.

TValue

Type of items, implementing the IIncrementalKeyedCollectionItem<TKey> interface.

Constructors

Name Description
IncrementalKeyedCollection(ImmutableDictionary<TKey, IncrementalKeyedCollection<TKey, TValue>.Item>, Boolean)

Properties

Name Description
Count

Gets the number of items in the current collection.

Empty

Gets an IncrementalKeyedCollection<TKey, TValue> that represents the absence of any change in the collection.

IsEmpty

Methods

Name Description
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, if an item with the same key already exists, update it with the given new values.

AddOrApplyChanges(TValue[])

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of adding items, or, if any item with the same key already exists, update it with the given new values.

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, if any item with the same key already exists, update it with the given new values.

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

Overrides the current collection with another collection and returns the result.

Create(ImmutableDictionary<TKey, IncrementalKeyedCollection<TKey, TValue>.Item>, Boolean)
GetEnumerator()
Remove(TKey)

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of removing an item from the collection.

Remove(TKey[])

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of removing items from the collection.

Remove(IEnumerable<TKey>)

Creates a IncrementalKeyedCollection<TKey, TValue> that contains all operations already contained in the current object, plus the operation of removing items from the collection.

Explicit Interface Implementations

Name Description
IIncrementalObject.ApplyChanges(Object, in ApplyChangesContext)