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

  1. C# - How to Create a BitArray?
  2. C# - BitArray.Get() Method with Example
  3. C# - BitArray.And() Method with Example
  4. C# - BitArray.Or() Method with Example
  5. C# - BitArray.Xor() Method with Example
  6. C# - BitArray.Not() Method with Example
  7. C# - BitArray.SetAll() Method with Example
  8. C# - BitArray.Set() Method with Example
  9. C# - BitArray.Clone() Method with Example
  10. C# - BitArray.CopyTo() Method with Example
  11. C# - BitArray.Length Property with Example



Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.