Example #1
0
        static void Main(string[] args)
        {
            int[]         arr = { 1, 2, 3, 4, 5 };
            HashSet <int> hs  = new HashSet <int>(arr);

            int[]         arr2 = { 4, 5, 6 };
            HashSet <int> hs2  = new HashSet <int>(arr2);
            RectSet       rs   = new RectSet(hs);
            RectSet       rs2  = new RectSet(hs2);
            RectSet       rs3  = rs + rs2;

            foreach (int x in rs3.GetSet)
            {
                Console.Write(x + " ");
            }
            Console.WriteLine();
            RectSet rs4 = rs * rs2;

            foreach (int x in rs4.GetSet)
            {
                Console.Write(x + " ");
            }
            Console.WriteLine();
            RectSet rs5 = rs ^ rs2;

            foreach (int x in rs5.GetSet)
            {
                Console.Write(x + " ");
            }
            Console.ReadKey();
        }
Example #2
0
        static void Main()
        {
            do
            {
                Console.Clear();

                int[]         arr1 = { 1, 2, 3, 4, 5 };
                HashSet <int> hs1  = new HashSet <int>(arr1);
                RectSet       rs1  = new RectSet(hs1);
                int[]         arr2 = { 4, 5, 6 };
                HashSet <int> hs2  = new HashSet <int>(arr2);
                RectSet       rs2  = new RectSet(hs2);

                RectSet rs3 = rs1 + rs2;
                foreach (int x in rs3.GetSet)
                {
                    Console.Write(x + " ");
                }
                Console.WriteLine();

                rs3 = rs1 * rs2;
                foreach (int x in rs3.GetSet)
                {
                    Console.Write(x + " ");
                }
                Console.WriteLine();

                rs3 = rs1 ^ rs2;
                foreach (int x in rs3.GetSet)
                {
                    Console.Write(x + " ");
                }
                Console.WriteLine();

                Console.WriteLine("Press Esc to exit. Press any other key to continue.");
            } while (Console.ReadKey(true).Key != ConsoleKey.Escape);
        }