static void Main(string[] args)
        {
            NumeroBinario objBinario = "1001";
            NumeroDecimal objDecimal = 9;

            Console.Title = "Ejercicio Nro 22";

            Console.WriteLine("Número Binario:{0}\nNúmero Decimal:{1}",
                              (string)objBinario, (double)objDecimal);

            if (objBinario == objDecimal)
            {
                Console.WriteLine("Son iguales");
            }
            else
            {
                Console.WriteLine("Son distintos");
            }

            Console.Write("Resta en binario: ");
            Console.WriteLine(objBinario - objDecimal);
            Console.Write("Suma en binario: ");
            Console.WriteLine(objBinario + objDecimal);
            Console.Write("Resta en decimal: ");
            Console.WriteLine(objDecimal - objBinario);
            Console.Write("Suma en decimal: ");
            Console.WriteLine(objDecimal + objBinario);

            Console.ReadKey();
        }
        public static string operator -(NumeroBinario numBin, NumeroDecimal numDec)
        {
            double auxConvNumBin = Conversor.BinarioDecimal((string)numBin);
            double auxConvNumDec = auxConvNumBin - (double)numDec;
            string aNumBin       = Conversor.DecimalBinario(auxConvNumDec);

            NumeroBinario auxNumBin = new NumeroBinario(aNumBin);

            return((string)auxNumBin);
        }
        public static string operator +(NumeroBinario numBin, NumeroDecimal numDec)
        {
            double        auxConvNumDec = Conversor.BinarioDecimal((string)numBin);
            string        auxConvNumBin = null;
            NumeroDecimal auxNumDec     = auxConvNumDec;
            NumeroBinario auxNumBin;

            auxNumDec     = (double)auxNumDec + (double)numDec;
            auxConvNumBin = Conversor.DecimalBinario((double)auxNumDec);
            auxNumBin     = new NumeroBinario(auxConvNumBin);

            return((string)auxNumBin);
        }
        static void Main(string[] args)
        {
            NumeroBinario nBin   = "110";
            NumeroDecimal nDec   = 12;
            double        resDec = 0;
            string        resBin = null;

            resDec = nDec + nBin;
            Console.WriteLine("{0}d + {1}b = {2}d", (double)nDec, (string)nBin, resDec);

            resDec = nDec - nBin;
            Console.WriteLine("{0}d - {1}b = {2}d", (double)nDec, (string)nBin, resDec);

            nBin = "1100";
            nDec = 2;

            resBin = nBin + nDec;
            Console.WriteLine("{0}b + {1}d = {2}d", (string)nBin, (double)nDec, resBin);

            resBin = nBin - nDec;
            Console.WriteLine("{0}b - {1}d = {2}d", (string)nBin, (double)nDec, resBin);

            Console.WriteLine("Convertir {0}b a decimal: {1}", (string)nBin, Conversor.BinarioDecimal((string)nBin));
            Console.WriteLine("Convertir {0}d a binario: {1}", (double)nDec, Conversor.DecimalBinario((double)nDec));

            Console.WriteLine("Igualdad entre {0}b y {1}d = {2}", (string)nBin, (double)nDec, (nBin == nDec).ToString());
            Console.WriteLine("Desigualdad entre {0}b y {1}d = {2}", (string)nBin, (double)nDec, (nBin != nDec).ToString());

            nBin = "110";
            nDec = 6;

            Console.WriteLine("Igualdad entre {0}b y {1}d = {2}", (double)nDec, (string)nBin, (nDec == nBin).ToString());
            Console.WriteLine("Desigualdad entre {0}b y {1}d = {2}", (double)nDec, (string)nBin, (nDec != nBin).ToString());

            Console.ReadKey();
        }