public static void BitArray() { var length = 7; // Create a bool array with desired length var boolArray = new BoolArray(length); Console.WriteLine("--------------------------- BitArray ---------------------------"); boolArray.Setter(0, true); Console.WriteLine("Set value 1 at index 0"); boolArray.DisplayArray(); boolArray.Setter(1, true); Console.WriteLine("Set value 1 at index 1"); boolArray.DisplayArray(); boolArray.Setter(2, true); Console.WriteLine("Set value 1 at index 2"); boolArray.DisplayArray(); boolArray.Setter(1, false); Console.WriteLine("Set value 0 at index 1"); boolArray.DisplayArray(); boolArray.Insert(0, false); Console.WriteLine("Set value 0 at index 0"); boolArray.DisplayArray(); boolArray.Remove(0); Console.WriteLine("removed value at index 0"); boolArray.DisplayArray(); boolArray.Append(true); Console.WriteLine("Appended 1"); boolArray.DisplayArray(); boolArray.Prepend(true); Console.WriteLine("Prepended 1"); boolArray.DisplayArray(); boolArray.Prepend(false); Console.WriteLine("Prepended 0"); boolArray.DisplayArray(); }
public BooleanArrayStack(int length) { _length = length; _array = new BoolArray(length); Counter = 0; }