This documentation is archived and is not being maintained.

BitArray.Length Property

Gets or sets the number of elements in the BitArray.

[Visual Basic]
Public Property Length As Integer
[C#]
public int Length {get; set;}
[C++]
public: __property int get_Length();
public: __property void set_Length(int);
[JScript]
public function get Length() : int;
public function set Length(int);

Property Value

The number of elements in the BitArray.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The property is set to a value that is less than zero.

Remarks

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.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

BitArray Class | BitArray Members | System.Collections Namespace

Show: