BitArray.Length 屬性

定義

取得或設定 BitArray 中的項目數。

public:
 property int Length { int get(); void set(int value); };
public int Length { get; set; }
member this.Length : int with get, set
Public Property Length As Integer

屬性值

BitArray 中的項目數。

例外狀況

此屬性會設為小於零的值。

備註

Length 和會 Count 傳回相同的值。 Length 可以設定為特定值,但 Count 為唯讀。

如果 Length 設定為小於 Count的值,則會 BitArray 截斷 ,並刪除索引 value -1 之後的專案。

如果 Length 設定為大於 Count的值,則新項目會設定為 false

擷取此屬性的值是作業 O(1) 。 設定此屬性是作業 O(n)

適用於