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
| Name | Description |
|---|---|
T |
- Inheritance
-
objectObjectCollectionT<T>
- Derived
Constructors
ObjectCollectionT()
protected ObjectCollectionT()
ObjectCollectionT(ADTObject, string)
protected ObjectCollectionT(ADTObject parent, string parentNavigatorName)
Parameters
| Name | Type | Description |
|---|---|---|
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
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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
item |
T | The object to locate in the System.Collections.Generic.ICollection<T>. |
Returns
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
| Name | Type | Description |
|---|---|---|
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 |
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source System.Collections.Generic.ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
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
| Name | Type | Description |
|---|---|---|
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
itemwithin 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
| Name | Type | Description |
|---|---|---|
index |
int | The zero-based index at which |
item |
T | The object to insert. The value can be null for reference types. |
Exceptions
- ArgumentOutOfRangeException
indexis less than 0.
-or-
indexis 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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
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
oldIndexornewIndexis 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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
item |
T | The object to remove from the System.Collections.Generic.ICollection<T>. |
Returns
- bool
true if
itemwas successfully removed from the System.Collections.Generic.ICollection<T>; otherwise, false. This method also returns false ifitemis 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
| Name | Type | Description |
|---|---|---|
index |
int | The zero-based index of the element to remove. |
Exceptions
- ArgumentOutOfRangeException
indexis less than 0.
-or-
indexis equal to or greater than System.Collections.Generic.List<T>.Count.