Performs a bitwise Or of two BitArray instances.
- value
- The BitArray to Or with the current instance.
A BitAray whose bit values are the bitwise Or of the BItArray instance and the argument BitArray.
The result of the Or operation overwrites the original instance.
The two BitArrays must be the same length. If they are not an ArgumentException will be thrown.
C# Example
using System; using System.Collections; public class BitArrayOr { public static void Main () { BitArray leftOperand = new BitArray (new bool [] {true, false, false, true}); BitArray rightOperand = new BitArray (new bool [] {true, false, true, false}); BitArrayOut.PrintBitArray (leftOperand, " Or "); BitArrayOut.PrintBitArray (rightOperand, " = "); leftOperand.Or(rightOperand); BitArrayOut.PrintBitArray (leftOperand, "\n"); } } public static class BitArrayOut { internal static void PrintBitArray (BitArray bitArray) { Console.Write (BitArrayToString (bitArray)); } internal static void PrintBitArray (BitArray bitArray, string symbol) { PrintBitArray (bitArray); Console.Write (symbol); } private static string BitArrayToString (BitArray bitArray) { StringBuilder stringBuilder = new StringBuilder (); for (int i = bitArray.Count - 1; i > -1; i--) { char digit = bitArray[i] ? '1' : '0'; stringBuilder.Append (digit); } return stringBuilder.ToString(); } }Compiling and running the above example generates the following output:
1001 Or 0101 = 1101
Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0