Exemple #1
0
        static void Main(string[] args)
        {
            int valor = 2;

            TryFactory.Try(
                () =>
            {
                throw new SerializationException();
            }
                ).Catch <Exception>(ManejarError);


            TryFactory.Try(() =>
            {
                Prueba pt = new Prueba();
                pt.Suma(valor, valor, valor, valor);
                Console.WriteLine();
            }).Catch <ArgumentException, ArgumentNullException>(ManejarError);

            TryOpenFile();
            TryWithUsing();
            string origen = string.Empty;

            TryFactory.Try(() => Console.WriteLine("")).Catch <Exception, string>(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch <Exception>(ManejarError);
            TryFactory.Try(() => Console.WriteLine("")).Catch(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch(ManejarError);
            TryFactory.Try(() => Console.WriteLine("")).Catch <Exception, ArgumentNullException, string>(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch <Exception, ArgumentNullException>(ManejarError);

            Console.ReadLine();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            int valor = 2;

            TryFactory.Try(
                () =>
                    {
                        throw new SerializationException();
                    }
            ).Catch<Exception>(ManejarError);


            TryFactory.Try(() =>
            {
                Prueba pt =  new Prueba();
                pt.Suma(valor, valor, valor, valor);
                Console.WriteLine();
            }).Catch<ArgumentException,ArgumentNullException>(ManejarError);

            TryOpenFile();
            TryWithUsing();
            string origen = string.Empty;
            TryFactory.Try(() => Console.WriteLine("")).Catch<Exception,string>(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch<Exception>(ManejarError);
            TryFactory.Try(() => Console.WriteLine("")).Catch(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch(ManejarError);
            TryFactory.Try(() => Console.WriteLine("")).Catch<Exception,ArgumentNullException,string>(TryCatchWeb.ControlError, origen);
            TryFactory.Try(() => Console.WriteLine("")).Catch<Exception, ArgumentNullException>(ManejarError);

            Console.ReadLine();
        }