IList<T>

Namespace: TSUI.Collections
Extends: None
Implements: N/A
Exported: Yes
JSDoc status: Complete

Associated source files:

Description

Definition for a List - provides a wrapper for JS arrays with additional methods. Uses generics to enforce stronger typing.

Public Methods

Add(object: T): void;
Adds the specified object to the end of the list.
  • object : The object to be added to the list.
AddRange(objects: IList<T>): void;
Adds the specified list of objects to the end of the list.
  • objects : The list of objects to be added.
Clear(): void;
Clears the list of all objects.
Clone(): IList<T>;
Creates a shallow clone of the list. Note: Reference-type objects are not deep cloned.
  • Returns : The new (clone) list.
Concat(other: IList<T>): IList<T>;
Concatenates two lists. Does not modify either original list.
  • other : The list to be concatenated with.
  • Returns : A list containing this list followed by the other list.
Contains(object: T): bool;
Determines whether the object is contained within the list.
  • object : The object to be searched for.
  • Returns : True if the object is contained within the list, otherwise false.
CopyTo(dest: IList<T>): void;
Copies the list to another list.
  • dest : The list to be copied into.
CopyTo(dest: IList<T>, offset: number): void;
Copies the list into another list, starting at the specified index.
  • dest : The list to be copied into.
  • offset : The index at which to start copying.
CopyTo(dest: IList<T>, offset: number, count: number): void;
Copies the specified number of items into another list, starting at the specified index.
  • dest : The list to be copied into.
  • offset : The index at which to start copying.
  • count : The number of items to be copied.
Count(): number;
  • Returns : The number of items in the list (the length)
ElementAt(index: number): T;
  • Returns : The element at the specified index or null if out of range.
  • index : The index of the element to get.
Equals(object: any): bool;
  • Returns : Whether this list is equal to the specified object.
  • object : The object to test for equality.
IndexOf(object: T): number;
  • Returns : The index of the specified object or -1 if not found.
  • object : The object to be searched for.
Insert(object: T, index: number): void;
Inserts the specified object into the list at the specified index.
  • object : The object to be inserted.
  • index : The index at which to insert the object.
InsertRange(objects: IList<T>, index: number): void;
Inserts a list of objects at the specified index - expands the list at that index. Does not overwrite existing items.
  • objects : The list of objects to be inserted.
  • index : The index at which to start inserting.
Range(index: number): IList<T>;
  • Returns : A list containing the specified range of objects from the list. Takes from index to end of the list.
  • index : The index to start the range.
Range(index: number, count?: number): IList<T>;
  • Returns : A list containing the specified range of objects from the list.
  • index : The index to start the range.
  • count : The number of items to take.
Remove(object: T): void;
Removes the specified object from the list.
  • object : The object to be removed.
RemoveAll(objects: IList<T>): void;
Removes the specified list of objects from the list. Only fires one modified event.
  • objects : The list of objects to be removed.
RemoveAt(index: number): T;
Removes the element at the specified index.
  • index : The index of the object to be removed.
  • Returns : The object which has been removed.
RemoveRange(index: number, count: number): IList<T>;
Removes the specified range of objects from the list.
  • index : The index at which to start removing.
  • count : The number of objects to remove.
  • Returns : A list containing the removed objects.
Reverse(): void;
Reverses the list of objects.
Sort(): void;
Sorts the list of objects using a ToStringComparer.
Sort(comparer: IComparer): void;
Sorts the list of objects using the specified comparer.
  • comparer : The comparer to use while sorting.
ToArray(): T[];
Converts the list to a basic array.
  • Returns : A clone of the underlying array.

Public Properties

OnModified: Events.CollectionModifiedEvent<T>
Fired when the collection is modified i.e. added to, removed from or re-ordered

Last edited Aug 3, 2013 at 10:43 PM by EdwardNutting, version 15

Comments

No comments yet.