Home »
.Net »
C# Programs
C# BitArray Class Reference – Properties, Methods, Examples / Programs
BitArray Class
BitArray class is basically used to manage a compact array of bit values. Here, each bit is represented by using boolean values true (0) or false (1). To use BitArray class – we need to include System.Collections namespace.
There are some important points regarding BitArray:
- We can access elements of BitArray using an integer index. Here index is started from 0.
- In BitArray collection Capacity and Count property are always the same.
- In BitArray we can increase or decrease the number of elements in BitArray using the Length property.
C# BitArray Class Constructors
There are following constructors are used in BitArray class:
- BitArray(Int32):
This constructor is used to create an object of BitArray class that can hold a given number of bits values. All bits will be set to false by default.
- BitArray(Int32,boolean):
This constructor is used to create an object of BitArray class that can hold a given number of bits values. All bits will be set by a given Boolean value.
- BitArray(BitArray):
This constructor is used to create an object of BitArray class using another object of BitArray class.
- BitArray(Boolean[]):
This constructor is used to create an object of BitArray class initialized with a passed array of Boolean values.
- BitArray(Boolean[]):
This constructor is used to create an object of BitArray class initialized with a passed array of bytes values.
This section contains the solved C# BitArray Class Properties, Methods, Examples . Practice these programs to learn the concept of array of bit values, these programs contain the solved code, outputs, and the detailed explanation of the statements, functions used in the C# BitArray Class Reference – Properties, Methods, Examples / Programs.
List of C# BitArray Class Reference – Properties, Methods, Examples
- C# - How to Create a BitArray?
- C# - BitArray.Get() Method with Example
- C# - BitArray.And() Method with Example
- C# - BitArray.Or() Method with Example
- C# - BitArray.Xor() Method with Example
- C# - BitArray.Not() Method with Example
- C# - BitArray.SetAll() Method with Example
- C# - BitArray.Set() Method with Example
- C# - BitArray.Clone() Method with Example
- C# - BitArray.CopyTo() Method with Example
- C# - BitArray.Length Property with Example