The length property is used to gets or sets the number of elements in the BitArray.
Our BitArray.
BitArray arr = new BitArray( 5 );
To calculate the length, use the length property.
Console.WriteLine( "Length: {0}", arr.Length );You can try to run the following code to learn how to work with Length property of BitArray class.
Example
using System;
using System.Collections;
public class Demo {
public static void Main() {
BitArray arr = new BitArray( 5 );
Console.WriteLine( "Count: {0}", arr.Count );
Console.WriteLine( "Length: {0}", arr.Length );
}
}Output
Count: 5 Length: 5