SynchronizedList

Ecng.Collections

Represents a thread-safe list that supports range operations and notification events.

Наследует: SynchronizedCollection<T, List<T>>

Реализует: INotifyListEx<T>, INotifyList<T>, INotifyCollection<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IList<T>, IListEx<T>, ICollectionEx<T>

Конструкторы

SynchronizedList
public SynchronizedList(int capacity)
synchronizedList = SynchronizedList(capacity)

Represents a thread-safe list that supports range operations and notification events.

SynchronizedList
public SynchronizedList()
synchronizedList = SynchronizedList()

Initializes a new instance of the SynchronizedList class with default capacity.

Методы

AddRange
public void AddRange(IEnumerable<T> items)
synchronizedList.AddRange(items)

Adds a range of items to the list in a thread-safe manner.

items
The items to add.
GetRange
public IEnumerable<T> GetRange(int index, int count)
result = synchronizedList.GetRange(index, count)

Retrieves a range of items from the list starting at the specified index, in a thread-safe manner.

index
The zero-based starting index of the range to retrieve.
count
The number of items to retrieve.

Возвращает: An enumerable containing the specified range of items.

OnAdded
protected override void OnAdded(T item)
synchronizedList.OnAdded(item)

Called after an item is added to the list, raising the AddedRange event.

item
The item that was added.
OnGetItem
protected override T OnGetItem(int index)
result = synchronizedList.OnGetItem(index)

Retrieves an item at the specified index from the inner list.

index
The zero-based index of the item to retrieve.

Возвращает: The item at the specified index.

OnIndexOf
protected override int OnIndexOf(T item)
result = synchronizedList.OnIndexOf(item)

Returns the index of the specified item in the inner list.

item
The item to locate.

Возвращает: The zero-based index of the item, or -1 if not found.

OnInsert
protected override void OnInsert(int index, T item)
synchronizedList.OnInsert(index, item)

Inserts an item into the inner list at the specified index.

index
The zero-based index at which to insert the item.
item
The item to insert.
OnRemoveAt
protected override void OnRemoveAt(int index)
synchronizedList.OnRemoveAt(index)

Removes an item from the inner list at the specified index.

index
The zero-based index of the item to remove.
OnRemoved
protected override void OnRemoved(T item)
synchronizedList.OnRemoved(item)

Called after an item is removed from the list, raising the RemovedRange event.

item
The item that was removed.
RemoveRange
public void RemoveRange(IEnumerable<T> items)
synchronizedList.RemoveRange(items)

Removes a range of items from the list in a thread-safe manner.

items
The items to remove.
RemoveRange
public int RemoveRange(int index, int count)
result = synchronizedList.RemoveRange(index, count)

Removes a range of items from the list starting at the specified index, in a thread-safe manner.

index
The zero-based starting index of the range to remove.
count
The number of items to remove.

Возвращает: The number of items actually removed.

События

AddedRange
public event Action<IEnumerable<T>> AddedRange
synchronizedList.AddedRange += handler

Occurs when a range of items is added to the list.

RemovedRange
public event Action<IEnumerable<T>> RemovedRange
synchronizedList.RemovedRange += handler

Occurs when a range of items is removed from the list.