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

TDocument

Type of item in the collection.

Inheritance
ObservedCollection<TDocument>
Implements
IReadOnlyList<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

items IReadOnlyList<TDocument>

The items making up the snapshot.

changes IReadOnlyList<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

IReadOnlyList<CollectionChange>

Count

public int Count { get; }

Property Value

int

this[int]

public TDocument this[int index] { get; }

Parameters

index int

Property Value

TDocument

Methods

GetEnumerator()

public IEnumerator<TDocument> GetEnumerator()

Returns

IEnumerator<TDocument>