Class ObservableOrderedSet<T>
- Namespace
- NMF.Collections.ObjectModel
- Assembly
- NMF.Collections.dll
Denotes an observable ordered set
public class ObservableOrderedSet<T> : OrderedSet<T>, INotifyCollectionChanged, INotifyCollectionChanging, INotifyPropertyChanged, IOrderedSetExpression<T>, IListExpression<T>, ISetExpression<T>, ICollectionExpression<T>, IEnumerableExpression<T>, IOrderedSet<T>, IList<T>, ISet<T>, ICollection<T>, IEnumerable<T>, ICollectionExpression, IEnumerableExpression, IList, ICollection, IEnumerable
Type Parameters
T
- Inheritance
-
DecoratedSet<T>OrderedSet<T>ObservableOrderedSet<T>
- Implements
-
IOrderedSet<T>IList<T>ISet<T>ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
Methods
Add(T)
Adds an element to the current set and returns a value to indicate if the element was successfully added.
public override bool Add(T item)
Parameters
item
TThe element to add to the set.
Returns
AsNotifiable()
Gets notifications for this collection
public INotifyCollection<T> AsNotifiable()
Returns
- INotifyCollection<T>
A collection that will notify clients as new elements change
Clear()
Removes all items from the ICollection<T>.
public override void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Insert(int, T)
Inserts an item to the IList<T> at the specified index.
public override void Insert(int index, T item)
Parameters
index
intThe zero-based index at which
item
should be inserted.item
TThe object to insert into the IList<T>.
Exceptions
- ArgumentOutOfRangeException
index
is not a valid index in the IList<T>.- NotSupportedException
The IList<T> is read-only.
OnCollectionChanged(NotifyCollectionChangedEventArgs)
protected void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters
OnCollectionChanging(NotifyCollectionChangedEventArgs)
protected void OnCollectionChanging(NotifyCollectionChangedEventArgs e)
Parameters
OnPropertyChanged(string)
protected void OnPropertyChanged(string property)
Parameters
property
string
Remove(T, int)
Removes the given item at the given arrayIndex
protected override bool Remove(T item, int index)
Parameters
item
TThe item to remove
index
intThe arrayIndex of the item
Returns
- bool
True, if the removal was successful, otherwise false
Replace(int, T, T)
Replaces the item at the given arrayIndex
protected override void Replace(int index, T oldValue, T newValue)
Parameters
index
intThe arrayIndex on which the item is replaced
oldValue
TThe old value
newValue
TThe new value
RequireEvents()
Determines whether events are subscribed
protected bool RequireEvents()
Returns
- bool
True, if there is any subscriber to CollectionChanged, PropertyChanged or CollectionChanging
SilentAdd(T)
Adds the element without notifications
protected bool SilentAdd(T item)
Parameters
item
Tthe element to be added
Returns
- bool
true, if the element was added, otherwise false
SilentClear()
Clears the collection contents without notifications
protected void SilentClear()
SilentInsert(int, T)
Inserts the element at the given index without notifications
protected void SilentInsert(int index, T item)
Parameters
index
intthe index at which the element should be inserted
item
Tthe item to insert
SilentRemove(T, int)
Removes the element without notifications
protected bool SilentRemove(T item, int index)
Parameters
item
Tthe element to remove
index
intthe index of the removed element
Returns
- bool
true, if the removal was successful, otherwise false
SilentReplace(int, T, T)
Replaces the element without notifications
protected void SilentReplace(int index, T oldValue, T newValue)
Parameters
index
intthe index of the element
oldValue
Tthe old value
newValue
Tthe new value
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Events
CollectionChanged
Occurs when the collection changes.
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
CollectionChanging
Gets raised when an attempt is made to change a given collection
public event EventHandler<NotifyCollectionChangedEventArgs> CollectionChanging
Event Type
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged