T_Cyjb_Collections_BitList - CYJB/Cyjb GitHub Wiki
管理位值的压缩列表,该值表示为布尔值,其中 true
表示位是打开的 (1),false
表示位是关闭的 (0)。
System.Object
Cyjb.Collections.ObjectModel.CollectionBase(Boolean)
Cyjb.Collections.ObjectModel.ListBase(Boolean)
Cyjb.Collections.BitList
Namespace: Cyjb.Collections
Assembly: Cyjb (in Cyjb.dll) Version: 1.0.23+7750dd8e971297c5fa962a3bee37fb78f72793f6
C#
public sealed class BitList : ListBase<bool>,
IEquatable<BitList>, ICollection, IEnumerable
The BitList type exposes the following members.
名称 | 说明 | |
---|---|---|
![]() |
BitList() | 初始化 BitList 类的新实例。 |
![]() |
BitList(IEnumerable(Boolean)) | 初始化 BitList 类的新实例,该实例包含从指定集合复制的元素。 |
![]() |
BitList(IEnumerable(Byte)) | 初始化 BitList 类的新实例,该实例包含从指定集合复制的元素。 |
![]() |
BitList(IEnumerable(Int32)) | 初始化 BitList 类的新实例,该实例包含从指定集合复制的元素。 |
![]() |
BitList(IEnumerable(UInt32)) | 初始化 BitList 类的新实例,该实例包含从指定集合复制的元素。 |
![]() |
BitList(Int32) | 初始化 BitList 类的新实例,该实例可拥有指定的初始容量。 |
![]() |
BitList(Int32, Boolean) | 初始化 BitList 类的新实例,该实例包含指定数目的位值,并设定为指定的初始值。 |
名称 | 说明 | |
---|---|---|
![]() |
Capacity | 获取或设置 BitList 在不调整大小的情况下能够容纳的元素总数。 |
![]() |
Count | 获取 BitList 中包含的元素数。 (重写 CollectionBase(T).Count.) |
![]() |
Item | 获取或设置指定索引处的元素。 (继承自 ListBase(T)。) |
名称 | 说明 | |
---|---|---|
![]() |
Add | 将指定对象添加到当前集合中。 (继承自 CollectionBase(T)。) |
![]() |
AddRange(IEnumerable(Boolean)) | 将指定集合的元素添加到 BitList 的末尾。 |
![]() |
AddRange(IEnumerable(Byte)) | 将指定集合的元素添加到 BitList 的末尾。 |
![]() |
AddRange(IEnumerable(Int32)) | 将指定集合的元素添加到 BitList 的末尾。 |
![]() |
AddRange(IEnumerable(UInt32)) | 将指定集合的元素添加到 BitList 的末尾。 |
![]() |
AddRange(Int32, Boolean) | 将指定长度的值添加到 BitList 的末尾。 |
![]() |
AllFalse |
判断当前列表中的值是否全为 false 。 |
![]() |
AllTrue |
判断当前列表中的值是否全为 true 。 |
![]() |
And | 对当前 BitList 中的元素和指定 BitList 中的相应元素执行按位“与”运算。 |
![]() |
Clear | 从 BitList 中移除所有元素。 (重写 CollectionBase(T).Clear().) |
![]() |
Contains | 确定当前列表是否包含指定对象。 (继承自 ListBase(T)。) |
![]() |
CopyTo | 从特定的 Array 索引处开始,将当前集合 的元素复制到一个 Array 中。 (继承自 CollectionBase(T)。) |
![]() |
Equals(BitList) | 指示当前对象是否等于同一类型的另一个对象。 |
![]() |
Equals(Object) | 确定指定对象是否等于当前对象。 (重写 Object.Equals(Object).) |
![]() |
Fill | 填充指定范围中的元素。 |
![]() |
FillAll | 将所有位填充为指定的值。 |
![]() |
FindSpace | 寻找可以放入指定模式的最小空当索引,允许使用超出当前列表范围的空当。 |
![]() |
GetEnumerator | 返回一个循环访问集合的枚举器。 (重写 CollectionBase(T).GetEnumerator().) |
![]() |
GetHashCode | 返回当前对象的哈希代码。 (重写 Object.GetHashCode().) |
![]() |
GetType | Gets the Type of the current instance. (继承自 Object。) |
![]() |
IndexOf(Boolean) | 确定 BitList 中特定项的索引。 (重写 ListBase(T).IndexOf(T).) |
![]() |
IndexOf(BitList, Int32) | 返回首个可以匹配指定模式的索引。 |
![]() |
IndexOf(Boolean, Int32) | 确定 BitList 中特定项的索引。 |
![]() |
Insert | 将元素插入当前列表的指定索引处。 (继承自 ListBase(T)。) |
![]() |
InsertRange(Int32, IEnumerable(Boolean)) | 将指定集合中的元素插入 BitList 的指定索引处。 |
![]() |
InsertRange(Int32, IEnumerable(Byte)) | 将指定集合中的元素插入 BitList 的指定索引处。 |
![]() |
InsertRange(Int32, IEnumerable(Int32)) | 将指定集合中的元素插入 BitList 的指定索引处。 |
![]() |
InsertRange(Int32, IEnumerable(UInt32)) | 将指定集合中的元素插入 BitList 的指定索引处。 |
![]() |
InsertRange(Int32, Int32, Boolean) | 将指定长度的值插入 BitList 的指定索引处。 |
![]() |
LastIndexOf(Boolean) | 确定 BitList 中特定项最后一次出现的索引。 |
![]() |
LastIndexOf(Boolean, Int32) | 确定 BitList 中特定项最后一次出现的索引。 |
![]() |
LeftShift | 将当前 BitList 中的所有位值左移 offset 位。 这里的左移是向着索引增大的方向移动。 |
![]() |
Not |
反转当前 BitList 中的所有位值,以便将设置为 true 的元素更改为 false ; 将设置为 false 的元素更改为 true 。 |
![]() |
Or | 对当前 BitList 中的元素和指定 BitList 中的相应元素执行按位“或”运算。 |
![]() |
Remove | 从当前列表中移除特定对象的第一个匹配项。 (继承自 ListBase(T)。) |
![]() |
RemoveAt | 移除当前列表中指定索引处的元素。 (继承自 ListBase(T)。) |
![]() |
RemoveRange | 从 BitList 中移除指定范围的元素。 |
![]() |
Resize | 将当前列表调整为指定的新大小。 |
![]() |
RightShift | 将当前 BitList 中的所有位值右移 offset 位。 这里的右移是向着索引减小的方向移动。 |
![]() |
ToString | Returns a string that represents the current object. (继承自 Object。) |
![]() |
Xor | 对当前 BitList 中的元素和指定 BitList 中的相应元素执行按位“异或”运算。 |
BitList 类采用位示图来保存布尔值,关于该数据结构的更多解释,请参见我的博文 《C# 位压缩列表》。
由于位操作的复杂性,BitList 类的一些方法效率并不高,实际使用时需要做好相应的测试。