Class Collection<T>
- Namespace
- Alternet.Base.Collections
- Assembly
- Alternet.UI.Common.dll
Represents a dynamic data collection that provides notifications when items get added, removed, or when the whole list is refreshed. In addition to the functionality available in ObservableCollection<T>, provides ItemInserted and ItemRemoved events.
public class Collection<T> : ObservableCollection<T>, IList<T>, ICollection<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IList, ICollection, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
Type Parameters
T
The type of elements in the collection.
- Inheritance
-
Collection<T>Collection<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Derived
Properties
- First
Gets the first item in the collection or 'default'.
- this[int]
Gets or sets the element at the specified index.
- this[long]
Gets or sets the element at the specified index.
- this[int?]
Gets or sets the element at the specified index.
- Last
Gets the last item in the collection or 'default'.
- RangeOpInProgress
Returns true if AddRange(IEnumerable<T>) is being executed at the moment.
- ThrowOnNullAdd
Gets or sets a value indicating whether an ArgumentNullException should be thrown on an attempt to add a
null
value to the collection.
Methods
- AddRange(IEnumerable<T>)
Adds the elements of the specified IEnumerable<T> to the end of the collection.
- ClearItems()
Removes all items from the collection.
- GetItemIndex(T, bool)
Retrieves the index of the specified item within the collection, and optionally raises an exception if the specified item is not within the collection.
- IndexOfOrNull(T)
Searches for the specified object and returns the zero-based index of the first occurrence within the entire collection.
- InsertItem(int, T)
Inserts an item into the collection at the specified index.
- OnItemInserted(int, T)
Raises the ItemInserted event with the provided arguments.
- OnItemRangeAdditionFinished(int, IEnumerable<T>)
Raises the ItemRangeAdditionFinished event with the provided arguments.
- OnItemRemoved(int, T)
Raises the ItemRemoved event with the provided arguments.
- Prepend(T)
Same as adding of the item, but prepends the items to the beginning of the list of items owned by this collection.
- RemoveFirst()
Removes the first item from the collection.
- RemoveItem(int)
Removes the item at the specified index of the collection.
- RemoveLast()
Removes the last item from the collection.
- SetCount(int, Func<T>)
Changes the number of elements in the collection.
- SetItemIndex(T, int)
Sets the index of the specified item in the collection.
Events
- ItemInserted
Occurs when an item is inserted in the collection.
- ItemRangeAdditionFinished
Occurs when an item range addition is finished in the collection.
- ItemRemoved
Occurs when an item is removed from the collection.