Table of Contents

Class ThrottledObservableCollectionWrapper<T>

Namespace
Loehnert.Utility.Collections
Assembly
Loehnert.Utility.dll

Wrapper for an observable collection which throttles the Add events.

public class ThrottledObservableCollectionWrapper<T> : INotifyCollectionChanged, IEnumerable<T>, IEnumerable, IDisposable

Type Parameters

T

Type of the items in the collection.

Inheritance
ThrottledObservableCollectionWrapper<T>
Implements
Inherited Members
Extension Methods

Remarks

Note that any other action than Add, forces to add the buffered items and therefore disables the throttling.

Constructors

ThrottledObservableCollectionWrapper(IObservableCollection<T>, int, Dispatcher)

Initializes a new instance of the ThrottledObservableCollectionWrapper<T> class.

public ThrottledObservableCollectionWrapper(IObservableCollection<T> observedCollection, int throttleTime, Dispatcher dispatcher = null)

Parameters

observedCollection IObservableCollection<T>

Observed collection.

throttleTime int

Time in ms, used for throttling the add events.

dispatcher Dispatcher

Dispatcher for the wrapper. Default is Dispatcher of the Current.

Exceptions

ArgumentNullException

Thrown when observedCollection is null.

ArgumentOutOfRangeException

Thrown when throttleTime is not between 0 (zero) and TotalMilliseconds of MaxValue.

ThrottledObservableCollectionWrapper(ObservableCollection<T>, int, Dispatcher)

Initializes a new instance of the ThrottledObservableCollectionWrapper<T> class.

public ThrottledObservableCollectionWrapper(ObservableCollection<T> observedCollection, int throttleTime, Dispatcher dispatcher = null)

Parameters

observedCollection ObservableCollection<T>

Observed collection.

throttleTime int

Time in ms, used for throttling the add events.

dispatcher Dispatcher

Dispatcher for the wrapper. Default is Dispatcher of the Current.

Exceptions

ArgumentNullException

Thrown when observedCollection is null.

ArgumentOutOfRangeException

Thrown when throttleTime is not between 0 (zero) and TotalMilliseconds of MaxValue.

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Remarks

Disposes the object.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

A IEnumerator<T> that can be used to iterate through the collection.

Events

CollectionChanged

Occurs when the collection changes.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler