Open sandboxFocus

Class IncrementalKeyedCollection<TKey, TValue>

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> : IIncrementalObject, IReadOnlyCollection<TValue>, IEnumerable<TValue>, IEnumerable, ICompileTimeSerializable where TKey : notnull 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, Item>, bool)

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(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.

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(params 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, Item>, bool)
GetEnumerator()
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.

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.

Extension Methods