Class ObservedCollection<TDocument>
- Namespace
- Cratis.Arc.Queries
- Assembly
- Cratis.Arc.Core.dll
A snapshot emitted by an observable collection query that carries the changes it represents.
public sealed class ObservedCollection<TDocument> : IReadOnlyList<TDocument>, IReadOnlyCollection<TDocument>, IEnumerable<TDocument>, IEnumerable, IHaveKnownChanges
Type Parameters
TDocumentType of item in the collection.
- Inheritance
-
ObservedCollection<TDocument>
- Implements
-
IReadOnlyList<TDocument>IReadOnlyCollection<TDocument>IEnumerable<TDocument>
- Inherited Members
- Extension Methods
Remarks
This is an ordinary IEnumerable<T> to every subscriber that does not care where the delta came from, so emitting it in place of a plain array changes nothing for existing consumers.
Constructors
ObservedCollection(IReadOnlyList<TDocument>, IReadOnlyList<CollectionChange>?)
A snapshot emitted by an observable collection query that carries the changes it represents.
public ObservedCollection(IReadOnlyList<TDocument> items, IReadOnlyList<CollectionChange>? changes)
Parameters
itemsIReadOnlyList<TDocument>The items making up the snapshot.
changesIReadOnlyList<CollectionChange>The changes this snapshot represents, or null when it is a whole snapshot.
Remarks
This is an ordinary IEnumerable<T> to every subscriber that does not care where the delta came from, so emitting it in place of a plain array changes nothing for existing consumers.
Properties
Changes
Gets the changes this emission represents, or null when the emission is a whole snapshot rather than a delta - the initial query result, or a re-read after reconnecting.
public IReadOnlyList<CollectionChange>? Changes { get; }
Property Value
Count
public int Count { get; }
Property Value
this[int]
public TDocument this[int index] { get; }
Parameters
indexint
Property Value
- TDocument
Methods
GetEnumerator()
public IEnumerator<TDocument> GetEnumerator()
Returns
- IEnumerator<TDocument>