- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is index-based I/O BitArray collection in C#?
The BitArray class manages a compact array of bit values, which are represented as Booleans, where true indicates that the bit is on (1) and false indicates the bit is off (0).
The following are the method of the index-based BitArray collection −
Sr.No. | Method & Description |
---|---|
1 | public BitArray And(BitArray value); Performs the bitwise AND operation on the elements in the current BitArray against the corresponding elements in the specified BitArray. |
2 | public bool Get(int index); Gets the value of the bit at a specific position in the BitArray. |
3 | public BitArray Not(); Inverts all the bit values in the current BitArray, so that elements set to true are changed to false, and elements set to false are changed to true. |
4 | public BitArray Or(BitArray value); Performs the bitwise OR operation on the elements in the current BitArray against the corresponding elements in the specified BitArray. |
5 | public void Set(int index, bool value); Sets the bit at a specific position in the BitArray to the specified value. |
6 | public void SetAll(bool value); Sets all bits in the BitArray to the specified value. |
7 | public BitArray Xor(BitArray value); Performs the bitwise eXclusive OR operation on the elements in the current BitArray against the corresponding elements in the specified BitArray. |
The following is an example −
using System; using System.Collections; public class Demo { public static void Main() { BitArray arr = new BitArray(10); Console.WriteLine( "Count: {0}", arr.Count ); } }
Advertisements