BitArray.Item[Int32] 屬性

定義

取得或設定在 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

要取得或設定的值之以零為起始的索引。

屬性值

index 位置的位元值。

例外狀況

index 小於零。

-或-

index 等於或大於 Count

備註

這個屬性可透過下列語法存取集合中的特定元素:myCollection[index]

C# 語言會使用此 關鍵詞來定義索引器,而不是實作 Item[] 屬性。 Visual Basic 會將 Item[] 實作為預設屬性,這樣會提供相同的索引功能。

擷取這個屬性的值是 O(1) 作業;設定屬性也是 O(1) 作業。

適用於

另請參閱