// Create a log table and force an overflow.
        public static void Main()
        {
            LogTable log = new LogTable(4);

            Console.WriteLine(
                "This example of \n   Exception.Message, \n" +
                "   Exception.HelpLink, \n   Exception.Source, \n" +
                "   Exception.StackTrace, and \n   Exception." +
                "TargetSite \ngenerates the following output.");

            try
            {
                for (int count = 1; ; count++)
                {
                    log.AddRecord(
                        String.Format(
                            "Log record number {0}", count));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\nMessage ---\n{0}", ex.Message);
                Console.WriteLine(
                    "\nHelpLink ---\n{0}", ex.HelpLink);
                Console.WriteLine("\nSource ---\n{0}", ex.Source);
                Console.WriteLine(
                    "\nStackTrace ---\n{0}", ex.StackTrace);
                Console.WriteLine(
                    "\nTargetSite ---\n{0}", ex.TargetSite);
            }
        }
        // Create a log table and force an overflow.
        public static void Main()
        {
            LogTable log = new LogTable(4);

            Console.WriteLine("This example of \n   Exception.Message, \n" +
                "   Exception.HelpLink, \n   Exception.Source, \n" +
                "   Exception.StackTrace, and \n   Exception." +
                "TargetSite \ngenerates the following output.");

            try
            {
                for (int count = 1; ; count++)
                {
                    log.AddRecord(String.Format("Log record number {0}", count));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("\nMessage ---\n{0}", ex.Message);
                Console.WriteLine("\nHelpLink ---\n{0}", ex.HelpLink);
                Console.WriteLine("\nSource ---\n{0}", ex.Source);
                Console.WriteLine("\nStackTrace ---\n{0}", ex.StackTrace.ToString());
                Console.WriteLine("\nTargetSite ---\n{0}", ex.TargetSite);
            }
        }
Ejemplo n.º 3
0
        // Create a log table and force an overflow.
        public static void Main()
        {
            LogTable log = new LogTable(4);

            Console.WriteLine(
                "This example of the Exception( string, Exception )" +
                "\nconstructor generates the following output.");
            Console.WriteLine(
                "\nExample of a derived exception " +
                "that references an inner exception:\n");
            try
            {
                for (int count = 1; ; count++)
                {
                    log.AddRecord(
                        String.Format(
                            "Log record number {0}", count));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString( ));
            }
        }