BitArray.Item[Int32] 属性

定义

获取或设置 BitArray 中特定位置的位值。Gets or sets the value of the bit at a specific position in the BitArray.

public:
 property bool default[int] { bool get(int index); void set(int index, bool value); };
public bool this[int index] { get; set; }
member this.Item(int) : bool with get, set
Default Public Property Item(index As Integer) As Boolean

参数

index
Int32

要获取或设置的值的从零开始索引。The zero-based index of the value to get or set.

属性值

Boolean

位置 index 处的位值。The value of the bit at position index.

例外

index 小于零。index is less than zero.

- 或 --or- index 等于或大于 Countindex is equal to or greater than Count.

注解

通过此属性,可以使用以下语法来访问集合中的特定元素:myCollection[index]This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[index].

C # 语言使用 this 关键字来定义索引器,而不是实现 Item[] 属性。The C# language uses the this keyword to define the indexers instead of implementing the Item[] property. Visual Basic 将 Item[] 实现为默认属性,该属性提供相同的索引功能。Visual Basic implements Item[] as a default property, which provides the same indexing functionality.

检索此属性的值是一个 O(1) 操作; 设置属性也是一个 O(1) 操作。Retrieving the value of this property is an O(1) operation; setting the property is also an O(1) operation.

适用于

另请参阅