T_Cyjb_Collections_PooledList_1 - CYJB/Cyjb GitHub Wiki
使用 ArrayPool(T) 存储元素的列表,要求在不使用后主动调用 Dispose() 方法回收空间。
System.Object
Cyjb.Collections.PooledList(T)
Namespace: Cyjb.Collections
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public sealed class PooledList<T> : IDisposable
- T
- 列表中的元素类型。
名称 | 说明 | |
---|---|---|
![]() |
PooledList(T) | 使用指定的初始容量初始化 PooledList(T) 类的新实例。 |
名称 | 说明 | |
---|---|---|
![]() |
Capacity | 获取当前列表的容量。 |
![]() |
Item | 获取指定索引处元素的引用。 |
![]() |
Length | 获取当前列表的长度。 |
名称 | 说明 | |
---|---|---|
![]() |
Add(T) | 将指定元素添加到当前列表中。 |
![]() |
Add(ReadOnlySpan(T)) | 将指定的多个元素添加到当前列表中。 |
![]() |
Add(T, Int32) | 将指定元素重复多次添加到当前列表中。 |
![]() |
AddSpan | 添加指定长度的元素,并返回相应的切片用于初始化。 |
![]() |
AsSpan() | 返回当前列表的切片。 |
![]() |
AsSpan(Int32) | 返回当前列表的切片。 |
![]() |
AsSpan(Int32, Int32) | 返回当前列表的切片。 |
![]() |
Clear | 从当前集合中移除所有元素。 |
![]() |
CopyTo | 将当前列表中的元素复制到目标 Span(T)。 |
![]() |
Dispose | 释放需要回收的空间。 |
![]() |
EnsureCapacity | 确保当前实例至少可以容纳指定容量的字符。 |
![]() |
Equals | Determines whether the specified object is equal to the current object. (继承自 Object。) |
![]() |
GetEnumerator | 返回一个循环访问当前列表的枚举器。 |
![]() |
GetHashCode | Serves as the default hash function. (继承自 Object。) |
![]() |
GetPinnableReference | 返回对于可用于固定的 T 类型的对象的引用。 |
![]() |
GetType | Gets the Type of the current instance. (继承自 Object。) |
![]() |
Insert(Int32, T) | 将元素插入当前列表的指定索引处。 |
![]() |
Insert(Int32, ReadOnlySpan(T)) | 将多个元素插入当前列表的指定索引处。 |
![]() |
Insert(Int32, T, Int32) | 将指定元素重复多次插入到当前列表的指定索引处。 |
![]() |
InsertSpan | 在当前列表的指定索引处插入指定长度的元素,并返回相应的切片用于初始化。 |
![]() |
RemoveAt | 移除当前列表中指定索引处的元素。 |
![]() |
RemoveRange | 移除当前列表中指定索引处的多个元素。 |
![]() |
ToArray | 将当前列表的内容复制到新数组中。 |
![]() |
ToString | 返回当前元素的字符串表示形式。 (重写 Object.ToString().) |
![]() |
TryCopyTo | 尝试将当前列表中的元素复制到目标 Span(T),并返回已复制的元素个数。 |
适合临时使用列表,但又无法使用栈上分配的 ValueList(T) 的场景。