Skip to content

RangeObservableCollection<T>

Class in Oadm.Sdk.Client.Collections · Oadm.Sdk.Client.dll

ObservableCollection<T> with bulk operations that raise a single NotifyCollectionChangedAction.Reset instead of one event per item. Scale: adding, filtering or selecting 5,000 rows one by one raises 5,000 events, and every DataGrid, filter and summary bound to the collection reacts to each of them.

public class RangeObservableCollection<T> : ObservableCollection<T>, IResettableList

Inherits ObservableCollection<T>
Implements IResettableList

Guide: UI kit

RangeObservableCollection()

An empty collection.

RangeObservableCollection(IEnumerable<T> items)

A collection with items.

void AddRange(IEnumerable<T> items)

Appends items; one Add event for a single item, else one Reset.

void InsertRange(int index, IEnumerable<T> items)

Inserts items at index in their order; one Add event for a single item, else one Reset.

int RemoveAll(Predicate<T> match)

Removes every item matching match in O(n); one Remove event for a single item, else one Reset. Returns the number removed.

void RemoveFirst(int count)

Removes the first count items (e.g. the oldest of a capped log); one Remove event for a single item, else one Reset.

void ReplaceAll(IEnumerable<T> items)

Replaces the whole content; one Reset. Nothing happens when the content is the same.