Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Bitwise OR operation between the elements of BitArray in C#
Let us see how to implement Bitwise OR operation between the elements of BitArray −
Example
using System;
using System.Collections;
public class Demo {
public static void Main() {
BitArray arr1 = new BitArray(5);
BitArray arr2 = new BitArray(5);
arr1[0] = false;
arr1[1] = false;
arr2[0] = false;
arr2[1] = true;
Console.WriteLine("BitArray1 elements...");
foreach (bool res in arr1) {
Console.WriteLine(res);
}
Console.WriteLine("
BitArray2 elements...");
foreach (bool res in arr2) {
Console.WriteLine(res);
}
Console.WriteLine("
Bitwise OR operation...");
IEnumerable demoEnum = arr1.Or(arr2);
foreach(Object ob in demoEnum) {
Console.WriteLine(ob);
}
}
}
Output
This will produce the following output −
BitArray1 elements... False False False False False BitArray2 elements... False True False False False Bitwise OR operation... False True False False False
Advertisements