Skip to content

ObservableCollection

Andrei Fangli edited this page Jul 4, 2021 · 1 revision
API / ObservableCollection<TItem> class

Represents an observable collection.

Extends: ReadOnlyObservableCollection<TItem>, implements IObservableCollection<TItem>.

class ObservableCollection<TItem> extends ReadOnlyObservableCollection<TItem> implements IObservableCollection<TItem>

Template Parameters

  • TItem: the type of items the collection contains.

Constructors

Methods

  • push: appends new elements to the end of the collection, and returns the new length of the collection.
  • pop: removes the last element from the collection and returns it. If the collection is empty, undefined is returned.
  • unshift: inserts new elements at the start of the collection, and returns the new length of the collection.
  • shift: removes the first element from the collection and returns it. If the collection is empty, undefined is returned.
  • get: gets the item at the provided index.
  • set: sets the provided item at the provided index.
  • splice: removes and/or adds elements to the collection and returns the deleted elements.
  • clear: Clears the contents of the collection and returns the removed items, similar to calling collection.splice(0).
  • reset: resets the contents of the collection by clearing it and setting the provided items. Returns the new length of the collection. Similar to calling collection.splice(0, collection.length, ...items).
Clone this wiki locally