Table of Contents

Class OrderedSet<T>

Namespace
NMF.Collections.Generic
Assembly
NMF.Collections.dll

Denotes an implementation of an ordered set

public class OrderedSet<T> : DecoratedSet<T>, IList, ICollection, IOrderedSet<T>, IList<T>, ISet<T>, ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T
Inheritance
OrderedSet<T>
Implements
ISet<T>
Derived
Inherited Members

Properties

this[int]

Gets or sets the element at the specified index.

public T this[int index] { get; set; }

Parameters

index int

The zero-based index of the element to get or set.

Property Value

T

The element at the specified index.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList<T>.

NotSupportedException

The property is set and the IList<T> is read-only.

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 T

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.

AsReadOnly()

Returns a readonly view of the oredered set

public ReadOnlyOrderedSet<T> AsReadOnly()

Returns

ReadOnlyOrderedSet<T>

Clear()

Removes all items from the ICollection<T>.

public override void Clear()

Exceptions

NotSupportedException

The ICollection<T> is read-only.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public override IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the collection.

IndexOf(T)

Determines the index of a specific item in the IList<T>.

public int IndexOf(T item)

Parameters

item T

The object to locate in the IList<T>.

Returns

int

The index of item if found in the list; otherwise, -1.

Insert(int, T)

Inserts an item to the IList<T> at the specified index.

public virtual void Insert(int index, T item)

Parameters

index int

The zero-based index at which item should be inserted.

item T

The 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.

Remove(T)

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

public override sealed bool Remove(T item)

Parameters

item T

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.

Remove(T, int)

Removes the given item at the given arrayIndex

protected virtual bool Remove(T item, int index)

Parameters

item T

The item to remove

index int

The arrayIndex of the item

Returns

bool

True, if the removal was successful, otherwise false

RemoveAt(int)

Removes the IList item at the specified index.

public void RemoveAt(int index)

Parameters

index int

The zero-based index of the item to remove.

Exceptions

ArgumentOutOfRangeException

index is not a valid index in the IList.

NotSupportedException

The IList is read-only.

-or-

The IList has a fixed size.

Replace(int, T, T)

Replaces the item at the given arrayIndex

protected virtual void Replace(int index, T oldValue, T newValue)

Parameters

index int

The arrayIndex on which the item is replaced

oldValue T

The old value

newValue T

The new value