Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,906 questions

51,838 answers

573 users

How to use bitwise or operation between the elements of BitArray in C#

1 Answer

0 votes
using System;
using System.Collections; 

class Program
{
    public static void PrintBitArray(IEnumerable ba) { 
        foreach(Object obj in ba) { 
            Console.WriteLine(obj); 
        } 
    } 
    static void Main() {
        BitArray ba1 = new BitArray(5); 
        BitArray ba2 = new BitArray(5); 
  
        ba1[0] = true; 
        ba1[1] = false; 
        ba1[2] = false; 
        ba1[3] = true;         
        ba1[4] = false; 
  
        ba2[0] = false; 
        ba2[1] = false; 
        ba2[2] = true; 
        ba2[3] = false;         
        ba2[4] = true; 
  
        PrintBitArray(ba1.Or(ba2)); 
    } 
}



/*
run:

True
False
True
True
True

*/

 



answered Apr 20, 2020 by avibootz

Related questions

1 answer 146 views
1 answer 246 views
1 answer 34 views
2 answers 204 views
1 answer 174 views
2 answers 168 views
168 views asked Feb 14, 2017 by avibootz
...