[]
Data collection class recommended for use in LiveLinq to Objects.
public class IndexedCollection<T> : Collection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IBindingListView, IBindingList, IList, ICollection, IList<T>, ICollection<T>, IObservableSource<T>, IIndexedSource<T>, IEnumerable<T>, IEnumerable
| Name | Description |
|---|---|
| T | The type of the elements in the collection. |
If you don't have preexisting collection classes and need to create your own, the best choice is to use the built-in LiveLinq collection class IndexedCollection<T>. It is specifically optimized for LiveLinq use.
Usually, the element class T must implement the property change notification interface INotifyPropertyChanged. The easiest way to implement INotifyPropertyChanged is to derive the element class from IndexableObject.
In rare cases where implementing INotifyPropertyChanged is impossible, a custom PropertyChangeListener<T> can be provided instead.
For details, see Using the built-in collection class IndexedCollection(T) (LiveLinq to Objects).
For alternative options in LiveLinq to Objects, see LiveLinq to Objects: IndexedCollection(T) and other collection classes
The IndexedCollection<T> class is not needed in LiveLinq to DataSet and LiveLinq to XML, because in those cases LiveLinq works with collections that already exist in ADO.NET and XML.
| Name | Description |
|---|---|
| IndexedCollection() | Initializes a new instance of the IndexedCollection<T> class. |
| IndexedCollection(IList<T>) | Initializes a new instance of the IndexedCollection<T> class that contains elements copied from the specified list. |
| IndexedCollection(IList<T>, PropertyChangeListener<T>) | Initializes a new instance of the IndexedCollection<T> class that contains elements copied from the specified list, and provides a custom PropertyChangeListener<T>. |
| Name | Description |
|---|---|
| CreateNew | Gets or sets a delegate that is used to create new items. If it is null, a public parameterless constructor of type T is used. |
| Indexes | The collection of indexes for this IndexedCollection<T> |
| Name | Description |
|---|---|
| AddRange(IEnumerable<T>) | Adds the elements of the specified collection to the end of the IndexedCollection<T> |
| BeginUpdate() | Suspends notifications while massive changes are being made to the IndexedCollection<T>. |
| ClearItems() | Removes all elements from the IndexedCollection<T> |
| EndUpdate() | Ends notification suspension started with BeginUpdate(). |
| InsertItem(int, T) | Inserts an element into the IndexedCollection<T> at the specified ordinal position. |
| OnChanged(SourceChangeEventArgs<T>) | Raises the Changed event. |
| RemoveItem(int) | Removes the element of the IndexedCollection<T> at the specified ordinal position. |
| SetItem(int, T) | Replaces the element at the specified ordinal position. |
| Name | Description |
|---|---|
| Changed | Occurs after the collection has changed. |