Table of Contents

Class ObjectCollectionT<T>

Namespace
ArcanaDevelopment.adTempus.Client.Collections
Assembly
ArcanaDevelopment.adTempus.Client.dll

Base class for collections

public abstract class ObjectCollectionT<T> where T : ObjectBase

Type Parameters

NameDescription
T
Inheritance
object
ObjectCollectionT<T>
Derived

Constructors

ObjectCollectionT()

protected ObjectCollectionT()

ObjectCollectionT(ADTObject, string)

protected ObjectCollectionT(ADTObject parent, string parentNavigatorName)

Parameters

NameTypeDescription
parent ADTObject
parentNavigatorName string

Fields

Collection

protected readonly List<T> Collection

Field Value

List<T>

NavigatorName

protected string NavigatorName

Field Value

string

ParentFacade

protected ADTObject ParentFacade

Field Value

ADTObject

Properties

Count

Gets the number of elements contained in the System.Collections.Generic.ICollection<T>.

public int Count { get; }

Property Value

int

The number of elements contained in the System.Collections.Generic.ICollection<T>.

IsReadOnly

Indicates whether the collection is read-only

public bool IsReadOnly { get; }

Property Value

bool

Remarks

Attempting to update a read-only collection produces a System.NotSupportedException.

this[int]

Returns the item at the specified index

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

Parameters

NameTypeDescription
index int

Index of the item to return

Property Value

T

Methods

Add(T)

Adds an item to the System.Collections.Generic.ICollection<T>.

public virtual void Add(T item)

Parameters

NameTypeDescription
item T

The object to add to the System.Collections.Generic.ICollection<T>.

Exceptions

NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

CheckReadOnlyAndThrow()

Throws an exception if the collection is read-only.

protected void CheckReadOnlyAndThrow()

Clear()

Removes all items from the System.Collections.Generic.ICollection<T>.

public virtual void Clear()

Exceptions

NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

Contains(T)

Determines whether the System.Collections.Generic.ICollection<T> contains a specific value.

public virtual bool Contains(T item)

Parameters

NameTypeDescription
item T

The object to locate in the System.Collections.Generic.ICollection<T>.

Returns

bool

true if item is found in the System.Collections.Generic.ICollection<T>; otherwise, false.

CopyTo(T[], int)

Copies the elements of the System.Collections.Generic.ICollection<T> to an System.Array, starting at a particular System.Array index.

public void CopyTo(T[] array, int arrayIndex)

Parameters

NameTypeDescription
array T[]

The one-dimensional System.Array that is the destination of the elements copied from System.Collections.Generic.ICollection<T>. The System.Array must have zero-based indexing.

arrayIndex int

The zero-based index in array at which copying begins.

Exceptions

ArgumentNullException

array is null.

ArgumentOutOfRangeException

arrayIndex is less than 0.

ArgumentException

The number of elements in the source System.Collections.Generic.ICollection<T> is greater than the available space from arrayIndex to the end of the destination array.

IndexOf(T)

Searches for the specified object and returns the zero-based index of the first occurrence within the entire System.Collections.Generic.List<T>.

public int IndexOf(T item)

Parameters

NameTypeDescription
item T

The object to locate in the System.Collections.Generic.List<T>. The value can be null for reference types.

Returns

int

The zero-based index of the first occurrence of item within the entire System.Collections.Generic.List<T>, if found; otherwise, -1.

Insert(int, T)

Inserts an element into the System.Collections.Generic.List<T> at the specified index.

public virtual void Insert(int index, T item)

Parameters

NameTypeDescription
index int

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

item T

The object to insert. The value can be null for reference types.

Exceptions

ArgumentOutOfRangeException

index is less than 0.
-or-
index is greater than System.Collections.Generic.List<T>.Count.

MoveDown(T)

Moves the item down one spot in the collection (to a larger index)

public virtual int MoveDown(T item)

Parameters

NameTypeDescription
item T

The item to move

Returns

int

The item's new position, or -1 if the item was not found in the collection.

MoveItem(int, int)

Moves an item within the collection

public virtual void MoveItem(int oldIndex, int newIndex)

Parameters

NameTypeDescription
oldIndex int

The index to move the item from. Must be a valid index for the collection.

newIndex int

The index to move the item to. Must be a valid index for the collection.

Exceptions

ArgumentOutOfRangeException

Thrown if oldIndex or newIndex is not a valid index.

MoveItem(T, int)

Moves the item to the specified index in the collection

public virtual void MoveItem(T item, int newIndex)

Parameters

NameTypeDescription
item T

The item to move

newIndex int

MoveUp(T)

Moves the item up one spot in the collection (to a smaller index)

public virtual int MoveUp(T item)

Parameters

NameTypeDescription
item T

The item to move

Returns

int

The item's new position, or -1 if the item was not found in the collection.

Remove(T)

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

public virtual bool Remove(T item)

Parameters

NameTypeDescription
item T

The object to remove from the System.Collections.Generic.ICollection<T>.

Returns

bool

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

Exceptions

NotSupportedException

The System.Collections.Generic.ICollection<T> is read-only.

RemoveAt(int)

Removes the element at the specified index of the System.Collections.Generic.List<T>.

public virtual void RemoveAt(int index)

Parameters

NameTypeDescription
index int

The zero-based index of the element to remove.

Exceptions

ArgumentOutOfRangeException

index is less than 0.
-or-
index is equal to or greater than System.Collections.Generic.List<T>.Count.

Extension Methods