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



Count the number of elements in the BitArray class using the Count property.

Let us first set our BitArray class −

BitArray arr = new BitArray(10);

Now use the Count property as shown below −

Example

 Live Demo

using System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr = new BitArray(10);       Console.WriteLine( "Count: {0}", arr.Count );    } }

Output

Count: 10
Updated on: 2020-06-20T11:05:29+05:30

137 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements