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
TParent
the parent element
TCollected
the 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
parent
TParentthe 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
index
intThe zero-based index at which
item
should be inserted.item
TCollectedThe object to insert. The value can be null for reference types.
Exceptions
- ArgumentOutOfRangeException
<code class="paramref">index</code> is less than zero.
-or-
index
is greater than Count.
RemoveItem(int)
Removes the element at the specified index of the Collection<T>.
protected override void RemoveItem(int index)
Parameters
index
intThe zero-based index of the element to remove.
Exceptions
- ArgumentOutOfRangeException
<code class="paramref">index</code> is less than zero.
-or-
index
is 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
index
intThe zero-based index of the element to replace.
item
TCollectedThe 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-
index
is greater than Count.
SetOpposite(TCollected, TParent)
Sets the opposite element
protected abstract void SetOpposite(TCollected item, TParent newParent)
Parameters
item
TCollectedThe item for which the opposite should be set
newParent
TParentThe 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.