語言

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# 語言使用 this 關鍵字來定義索引器,而非實作該 Item[] 屬性。 Visual Basic 作為 Item[] 預設屬性實作,提供相同的索引功能。

取得此屬性的值是一個 O(1) 操作;設定該屬性也是一個 O(1) 操作。

適用於

另請參閱