Table of Contents

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
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

int

IsReadOnly

Gets a value indicating whether the list is read-only.

public bool IsReadOnly { get; }

Property Value

bool

this[int]

Gets or sets an item by index.

[JsonIgnore]
public T this[int Index] { get; set; }

Parameters

Index int

Property Value

T

Methods

Add(T)

Adds an item to the list.

public void Add(T Item)

Parameters

Item T

AddRange(IEnumerable<T>)

Adds all items of a source collection to the list.

public void AddRange(IEnumerable<T> Source)

Parameters

Source IEnumerable<T>

CheckAdding(T)

Checks whether an item can be added to the list.

protected virtual void CheckAdding(T Item)

Parameters

Item T

CheckRemoving(T)

Checks whether an item can be removed from the list.

protected virtual void CheckRemoving(T Item)

Parameters

Item T

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

Item T

Returns

bool

CopyTo(T[], int)

Copies the list items to an array.

public void CopyTo(T[] Array, int ArrayIndex)

Parameters

Array T[]
ArrayIndex int

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

Item T

Returns

int

Insert(int, T)

Inserts an item at the specified index.

public void Insert(int Index, T Item)

Parameters

Index int
Item T

OnCollectionChanged(NotifyCollectionChangedAction, object, int)

Raises the CollectionChanged event for a single item change.

protected virtual void OnCollectionChanged(NotifyCollectionChangedAction Action, object Item, int Index)

Parameters

Action NotifyCollectionChangedAction
Item object
Index int

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

Action NotifyCollectionChangedAction
NewItem object
OldItem object
Index int

OnCollectionChanged(NotifyCollectionChangedEventArgs)

Raises the CollectionChanged event.

protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs E)

Parameters

E NotifyCollectionChangedEventArgs

OnPropertyChanged(string)

Raises the PropertyChanged event.

protected virtual void OnPropertyChanged(string PropertyName)

Parameters

PropertyName string

Remove(T)

Removes an item from the list.

public bool Remove(T Item)

Parameters

Item T

Returns

bool

RemoveAt(int)

Removes the item at the specified index.

public void RemoveAt(int Index)

Parameters

Index int

Events

CollectionChanged

Occurs when the list changes.

public event NotifyCollectionChangedEventHandler CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler