一款简单易用的基础网络通讯组件库。

ConcurrentListT

线程安全的List,其基本操作和List一致。

Definition

命名空间: TouchSocket.Core
程序集: TouchSocket.Core (在 TouchSocket.Core.dll 中) 版本:3.0.0+ccaf96084d09f972257496d1dd63b8ba3c1e44f0
C#
public class ConcurrentList<T> : IList<T>, 
	ICollection<T>, IEnumerable<T>, IEnumerable, IReadOnlyList<T>, IReadOnlyCollection<T>
Inheritance
Object    ConcurrentListT
Implements
ICollectionT, IEnumerableT, IListT, IReadOnlyCollectionT, IReadOnlyListT, IEnumerable

类型参数

T

构造函数

属性

Capacity 获取或设置容量
Count 元素数量
IsReadOnly 是否为只读
Item 获取索引元素

方法

Add 添加元素
AddRange Adds the elements of the specified collection to the end of the ListT.
BinarySearch(T) Searches the entire sorted ListT for an element using the default comparer and returns the zero-based index of the element.
BinarySearch(T, IComparerT) Searches the entire sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
BinarySearch(Int32, Int32, T, IComparerT) Searches a range of elements in the sorted ListT for an element using the specified comparer and returns the zero-based index of the element.
Clear 清空所有元素
Contains 是否包含某个元素
ConvertAllTOutput Converts the elements in the current ListT to another type, and returns a list containing the converted elements.
CopyTo 复制到
EqualsDetermines whether the specified object is equal to the current object.
(继承自 Object。)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(继承自 Object。)
Find Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire ListT.
FindAll Retrieves all the elements that match the conditions defined by the specified predicate.
FindIndex(PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the entire ListT.
FindIndex(Int32, PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
FindIndex(Int32, Int32, PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
FindLast Searches for an element that matches the conditions defined by the specified predicate, and returns the last occurrence within the entire ListT.
FindLastIndex(PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the entire ListT.
FindLastIndex(Int32, PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
FindLastIndex(Int32, Int32, PredicateT) Searches for an element that matches the conditions defined by the specified predicate, and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
ForEach Performs the specified action on each element of the ListT.
GetEnumerator 返回迭代器
GetHashCodeServes as the default hash function.
(继承自 Object。)
GetRange Creates a shallow copy of a range of elements in the source ListT.
GetTypeGets the Type of the current instance.
(继承自 Object。)
IndexOf(T) 索引
IndexOf(T, Int32) Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that extends from the specified index to the last element.
IndexOf(T, Int32, Int32) Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the ListT that starts at the specified index and contains the specified number of elements.
Insert 插入
InsertRange Inserts the elements of a collection into the ListT at the specified index.
LastIndexOf(T) Searches for the specified object and returns the zero-based index of the last occurrence within the entire ListT.
LastIndexOf(T, Int32) Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that extends from the first element to the specified index.
LastIndexOf(T, Int32, Int32) Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the ListT that contains the specified number of elements and ends at the specified index.
MemberwiseCloneCreates a shallow copy of the current Object.
(继承自 Object。)
Remove 移除元素
RemoveAll Removes all the elements that match the conditions defined by the specified predicate.
RemoveAt 按索引移除
RemoveRange Removes a range of elements from the ListT.
Reverse Reverses the order of the elements in the entire ListT.
Reverse(Int32, Int32) Reverses the order of the elements in the specified range.
Sort Sorts the elements in the entire ListT using the default comparer.
Sort(ComparisonT) Sorts the elements in the entire ListT using the specified ComparisonT.
Sort(IComparerT) Sorts the elements in the entire ListT using the specified comparer.
Sort(Int32, Int32, IComparerT) Sorts the elements in a range of elements in ListT using the specified comparer.
ToArray Copies the elements of the ListT to a new array.
ToStringReturns a string that represents the current object.
(继承自 Object。)
TrimExcess Sets the capacity to the actual number of elements in the ListT, if that number is less than a threshold value.
TrueForAll Determines whether every element in the ListT matches the conditions defined by the specified predicate.

扩展方法

ForEachT 循环遍历每个元素,执行Action动作
(由 CollectionsExtension 定义。)
ForEachAsyncT 循环遍历每个元素,执行异步动作
(由 CollectionsExtension 定义。)
Map
(由 Mapper 定义。)
Map
(由 Mapper 定义。)
MapTTarget
(由 Mapper 定义。)
MapListT, T1
(由 Mapper 定义。)
ToJsonString 转换为Json
(由 SerializeConvert 定义。)

显式接口实现

IEnumerableGetEnumerator 返回迭代器组合

参见