Пример #1
0
        static void Main(string[] args)
        {
            BitContainer array = new BitContainer();

            array.pushBit(1);
            array.pushBit(0);
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());
            array[1] = 1;
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());
            array.pushBit(false);
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());
            for (int i = 0; i < 15; ++i)
            {
                array.pushBit(1);
            }
            array[10] = 0;
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());
            array.Remove(10);
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());
            array.Insert(10, 0);
            Console.WriteLine(array.ToString() + " " + array.Lenght.ToString());

            foreach (bool b in array)
            {
                Console.Write(b);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var b = new BitContainer();

            for (var i = 0; i < 8; i++)
            {
                b.PushBit(i % 2);
            }
            Console.WriteLine("ADD 8 bits, Bytes: {0}", b.Length / 8);
            foreach (var bit in b.MyEnumerator())
            {
                Console.Write("{0} ", bit);
            }
            Console.WriteLine();


            for (var i = 0; i < 7; i++)
            {
                b.PushBit(false);
            }
            Console.WriteLine("ADD 7 bits");
            Console.WriteLine(b.ToString());



            b.Insert(5, 1);
            Console.WriteLine("INSERT true TO 5");
            Console.WriteLine(b.ToString());


            b.Insert(1, false);
            Console.WriteLine("INSERT false TO 1");
            Console.WriteLine(b.ToString());



            b.Remove(0);
            Console.WriteLine("REMOVE FROM 0");
            Console.WriteLine(b.ToString());


//            b.Insert(-1, false);
//            b.Insert(b.Length, true);
//            b.Remove(20);

            b.Clear();
            Console.WriteLine("CLEAR");
            Console.WriteLine(b.ToString());
        }
Пример #3
0
 public BitEnum(BitContainer bits)
 {
     this.bits = bits;
 }