What is the Length property of BitArray class in C#?

CsharpProgrammingServer Side Programming

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

 Live Demo

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
raja
Published on 18-Sep-2018 08:29:38
Advertisements