Class ObservableOppositeList<TParent, TCollected>
- Namespace
- NMF.Collections.ObjectModel
- Assembly
- NMF.Collections.dll
Denotes the abstract base class for an observable opposite list
public abstract class ObservableOppositeList<TParent, TCollected> : ObservableList<TCollected>, IReadOnlyList<TCollected>, IReadOnlyCollection<TCollected>, IList, ICollection, INotifyCollectionChanging, INotifyPropertyChanged, INotifyCollectionChanged, IListExpression<TCollected>, IList<TCollected>, ICollectionExpression<TCollected>, IEnumerableExpression<TCollected>, IEnumerableExpression, ICollection<TCollected>, IEnumerable<TCollected>, IEnumerable
Type Parameters
TParentthe parent element
TCollectedthe type of collected elements
- Inheritance
-
Collection<TCollected>ObservableCollectionExtended<TCollected>ObservableList<TCollected>ObservableOppositeList<TParent, TCollected>
- Implements
-
IReadOnlyList<TCollected>IReadOnlyCollection<TCollected>IListExpression<TCollected>IList<TCollected>ICollectionExpression<TCollected>IEnumerableExpression<TCollected>ICollection<TCollected>IEnumerable<TCollected>
- Inherited Members
- Extension Methods
Constructors
ObservableOppositeList(TParent)
Creates a new instance
protected ObservableOppositeList(TParent parent)
Parameters
parentTParentthe parent element
Exceptions
- ArgumentNullException
thrown if the parent element is null
Properties
Parent
Gets the parent element
public TParent Parent { get; }
Property Value
- TParent
Methods
ClearItems()
Removes all elements from the Collection<T>.
protected override void ClearItems()
InsertItem(int, TCollected)
Inserts an element into the Collection<T> at the specified index.
protected override void InsertItem(int index, TCollected item)
Parameters
indexintThe zero-based index at which
itemshould be inserted.itemTCollectedThe object to insert. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
<code class="paramref">index</code> is less than zero.-or-
indexis greater than Count.
RemoveItem(int)
Removes the element at the specified index of the Collection<T>.
protected override void RemoveItem(int index)
Parameters
indexintThe zero-based index of the element to remove.
Exceptions
- ArgumentOutOfRangeException
<code class="paramref">index</code> is less than zero.-or-
indexis equal to or greater than Count.
SetItem(int, TCollected)
Replaces the element at the specified index.
protected override void SetItem(int index, TCollected item)
Parameters
indexintThe zero-based index of the element to replace.
itemTCollectedThe new value for the element at the specified index. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
<code class="paramref">index</code> is less than zero.-or-
indexis greater than Count.
SetOpposite(TCollected, TParent)
Sets the opposite element
protected abstract void SetOpposite(TCollected item, TParent newParent)
Parameters
itemTCollectedThe item for which the opposite should be set
newParentTParentThe new parent or null, if the item is removed
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.