Gets or sets the number of elements in the BitArray.
Assembly: mscorlib (in mscorlib.dll)
Public Property Length As Integer Get Set
public int Length { get; set; }
public: property int Length { int get (); void set (int value); }
member Length : int with get, set
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException |
The property is set to a value that is less than zero. |
Length and Count return the same value. Length can be set to a specific value, but Count is read-only.
If Length is set to a value that is less than Count, the BitArray is truncated and the elements after the index value -1 are deleted.
If Length is set to a value that is greater than Count, the new elements are set to false.
Retrieving the value of this property is an O(1) operation. Setting this property is an O(n) operation.
.NET Framework
Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0.NET Framework Client Profile
Supported in: 4, 3.5 SP1Portable Class Library
Supported in: Portable Class LibraryWindows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.