Class ObservableCollectionExtended<T>
- Namespace
- DynamicData.Binding
- Assembly
- DynamicData.dll
An override of observable collection which allows the suspension of notifications.
public class ObservableCollectionExtended<T> : ObservableCollection<T>, IList, ICollection, IReadOnlyList<T>, IReadOnlyCollection<T>, IObservableCollection<T>, INotifyCollectionChanged, INotifyPropertyChanged, INotifyCollectionChangedSuspender, IExtendedList<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
T
The type of the item.
- Inheritance
-
Collection<T>ObservableCollectionExtended<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
ObservableCollectionExtended()
Initializes a new instance of the ObservableCollectionExtended<T> class.
public ObservableCollectionExtended()
ObservableCollectionExtended(IEnumerable<T>)
Initializes a new instance of the ObservableCollectionExtended<T> class that contains elements copied from the specified collection.
public ObservableCollectionExtended(IEnumerable<T> collection)
Parameters
collection
IEnumerable<T>The collection from which the elements are copied.
Exceptions
- ArgumentNullException
The
collection
parameter cannot be null.
ObservableCollectionExtended(List<T>)
Initializes a new instance of the ObservableCollectionExtended<T> class that contains elements copied from the specified list.
public ObservableCollectionExtended(List<T> list)
Parameters
list
List<T>The list from which the elements are copied.
Exceptions
- ArgumentNullException
The
list
parameter cannot be null.
Methods
AddRange(IEnumerable<T>)
Adds the elements of the specified collection to the end of the collection.
public void AddRange(IEnumerable<T> collection)
Parameters
collection
IEnumerable<T>The collection whose elements should be added to the end of the List. The collection itself cannot be null, but it can contain elements that are null.
Exceptions
- ArgumentNullException
collection
is null.
InsertRange(IEnumerable<T>, int)
Inserts the elements of a collection into the ObservableCollectionExtended<T> at the specified index.
public void InsertRange(IEnumerable<T> collection, int index)
Parameters
collection
IEnumerable<T>Inserts the items at the specified index.
index
intThe zero-based index at which the new elements should be inserted.
Exceptions
- ArgumentNullException
collection
is null.- ArgumentOutOfRangeException
index
is less than 0.-or-index
is greater than Count.
Load(IEnumerable<T>)
Clears the list and Loads the specified items.
public void Load(IEnumerable<T> items)
Parameters
items
IEnumerable<T>The items.
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Raises the CollectionChanged event.
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
e
NotifyCollectionChangedEventArgsThe NotifyCollectionChangedEventArgs instance containing the event data.
OnPropertyChanged(PropertyChangedEventArgs)
Raises the PropertyChanged event.
protected override void OnPropertyChanged(PropertyChangedEventArgs e)
Parameters
e
PropertyChangedEventArgsThe PropertyChangedEventArgs instance containing the event data.
RemoveRange(int, int)
Removes a range of elements from the ObservableCollectionExtended<T>.
public void RemoveRange(int index, int count)
Parameters
index
intThe zero-based starting index of the range of elements to remove.
count
intThe number of elements to remove.
Exceptions
- ArgumentOutOfRangeException
index
is less than 0.-or-count
is less than 0.- ArgumentException
index
andcount
do not denote a valid range of elements in the List<T>.
SuspendCount()
Suspends count notifications.
public IDisposable SuspendCount()
Returns
- IDisposable
A disposable when disposed will reset the count.
SuspendNotifications()
Suspends notifications. When disposed, a reset notification is fired.
public IDisposable SuspendNotifications()
Returns
- IDisposable
A disposable when disposed will reset notifications.