Table of Contents

Class ObservableOppositeSet<TParent, TCollected>

Namespace
NMF.Collections.ObjectModel
Assembly
NMF.Collections.dll

Denotes the abstract base class for an observable set with opposites

public abstract class ObservableOppositeSet<TParent, TCollected> : ObservableSet<TCollected>, IList, ICollection, INotifyCollectionChanged, INotifyCollectionChanging, INotifyPropertyChanged, ISetExpression<TCollected>, ISet<TCollected>, ICollectionExpression<TCollected>, IEnumerableExpression<TCollected>, IEnumerableExpression, ICollection<TCollected>, IEnumerable<TCollected>, IEnumerable

Type Parameters

TParent

The type of the parent element

TCollected

The type of the elements

Inheritance
DecoratedSet<TCollected>
ObservableSet<TCollected>
ObservableOppositeSet<TParent, TCollected>
Implements
ISetExpression<TCollected>
ISet<TCollected>
ICollection<TCollected>
IEnumerable<TCollected>
Inherited Members
Extension Methods

Constructors

ObservableOppositeSet(TParent)

Creates a new instance

protected ObservableOppositeSet(TParent parent)

Parameters

parent TParent

the parent element

Exceptions

ArgumentNullException

Thrown if the parent is null

Properties

Parent

Gets the parent for this collection

public TParent Parent { get; }

Property Value

TParent

Methods

Add(TCollected)

Adds an element to the current set and returns a value to indicate if the element was successfully added.

public override bool Add(TCollected item)

Parameters

item TCollected

The element to add to the set.

Returns

bool

true if the element is added to the set; false if the element is already in the set.

Clear()

Removes all items from the ICollection<T>.

public override void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

Remove(TCollected)

Removes the first occurrence of a specific object from the ICollection<T>.

public override bool Remove(TCollected item)

Parameters

item TCollected

The object to remove from the ICollection<T>.

Returns

bool

true if item was successfully removed from the ICollection<T>; otherwise, false. This method also returns false if item is not found in the original ICollection<T>.

Exceptions

NotSupportedException

The ICollection<T> is read-only.

SetOpposite(TCollected, TParent)

Sets the opposite

protected abstract void SetOpposite(TCollected item, TParent newParent)

Parameters

item TCollected

the item for which the opposite should be set

newParent TParent

the new parent or null, if the element is deleted

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.