Performs the bitwise OR operation : BitArray « Collections Data Structure « C# / C Sharp

Performs the bitwise OR operation


 using System;
 using System.Collections;
 public class SamplesBitArray  {
    public static void Main()  {
       BitArray myBA1 = new BitArray( 4 );
       BitArray myBA2 = new BitArray( 4 );
       myBA1[0] = myBA1[1] = false;
       myBA1[2] = myBA1[3] = true;
       myBA2[0] = myBA2[2] = false;
       myBA2[1] = myBA2[3] = true;

       PrintValues( myBA1.Or( myBA2 ), 8 );
    public static void PrintValues( IEnumerable myList, int myWidth )  {
       int i = myWidth;
       foreach ( Object obj in myList ) {
          if ( i <= 0 )  {
             i = myWidth;
          Console.Write( "{0,8}", obj );



Related examples in the same category

1.Demonstrate BitArrayDemonstrate BitArray
2.Use BitArray collection as Flag
3.illustrates the use of a BitArrayillustrates the use of a BitArray
4.illustrates the use of BitArray methodsillustrates the use of BitArray methods
5.BitArray Class manages a compact array of bit values
6.Displays the properties and values of the BitArrays
7.BitArray.CopyTo copies the entire BitArray to a compatible one-dimensional Array
8.Gets the value of the bit at a specific position in the BitArray.
9.Inverts all the bit values in the current BitArray
10.Performing OR between BitArray instances of different sizes returns an exception
11.Performs bitwise exclusive OR operation