Class TripousList<T>
- Namespace
- Tripous
- Assembly
- Tripous.dll
Represents an observable list that wraps a List<T> and implements both generic and non-generic collection interfaces.
public class TripousList<T> : IList<T>, IList, ICollection<T>, IEnumerable<T>, ICollection, IEnumerable, INotifyCollectionChanged, INotifyPropertyChanged
Type Parameters
T
- Inheritance
-
TripousList<T>
- Implements
-
IList<T>ICollection<T>IEnumerable<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
TripousList()
Constructor.
public TripousList()
Fields
Items
Field
protected List<T> Items
Field Value
- List<T>
Properties
Count
Gets the number of items in the list.
public int Count { get; }
Property Value
IsReadOnly
Gets a value indicating whether the list is read-only.
public bool IsReadOnly { get; }
Property Value
this[int]
Gets or sets an item by index.
[JsonIgnore]
public T this[int Index] { get; set; }
Parameters
Indexint
Property Value
- T
Methods
Add(T)
Adds an item to the list.
public void Add(T Item)
Parameters
ItemT
AddRange(IEnumerable<T>)
Adds all items of a source collection to the list.
public void AddRange(IEnumerable<T> Source)
Parameters
SourceIEnumerable<T>
CheckAdding(T)
Checks whether an item can be added to the list.
protected virtual void CheckAdding(T Item)
Parameters
ItemT
CheckRemoving(T)
Checks whether an item can be removed from the list.
protected virtual void CheckRemoving(T Item)
Parameters
ItemT
Clear()
Removes all items from the list.
public void Clear()
Contains(T)
Returns true when the specified item exists in the list.
public bool Contains(T Item)
Parameters
ItemT
Returns
CopyTo(T[], int)
Copies the list items to an array.
public void CopyTo(T[] Array, int ArrayIndex)
Parameters
ArrayT[]ArrayIndexint
GetEnumerator()
Returns a generic enumerator for the list.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
IndexOf(T)
Returns the index of the specified item.
public int IndexOf(T Item)
Parameters
ItemT
Returns
Insert(int, T)
Inserts an item at the specified index.
public void Insert(int Index, T Item)
Parameters
IndexintItemT
OnCollectionChanged(NotifyCollectionChangedAction, object, int)
Raises the CollectionChanged event for a single item change.
protected virtual void OnCollectionChanged(NotifyCollectionChangedAction Action, object Item, int Index)
Parameters
ActionNotifyCollectionChangedActionItemobjectIndexint
OnCollectionChanged(NotifyCollectionChangedAction, object, object, int)
Raises the CollectionChanged event for a replace operation.
protected virtual void OnCollectionChanged(NotifyCollectionChangedAction Action, object NewItem, object OldItem, int Index)
Parameters
ActionNotifyCollectionChangedActionNewItemobjectOldItemobjectIndexint
OnCollectionChanged(NotifyCollectionChangedEventArgs)
Raises the CollectionChanged event.
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs E)
Parameters
OnPropertyChanged(string)
Raises the PropertyChanged event.
protected virtual void OnPropertyChanged(string PropertyName)
Parameters
PropertyNamestring
Remove(T)
Removes an item from the list.
public bool Remove(T Item)
Parameters
ItemT
Returns
RemoveAt(int)
Removes the item at the specified index.
public void RemoveAt(int Index)
Parameters
Indexint
Events
CollectionChanged
Occurs when the list changes.
public event NotifyCollectionChangedEventHandler CollectionChanged
Event Type
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler PropertyChanged