1

I have a code:

    class Program
    {
        public static void Main()
        {
            try
            {
                Execute();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }

        public static void Execute()
        {
            try
            {
                Step3();
            }
            catch (Exception ex)
            {
                Console.WriteLine("catch");
                throw new Exception("1");
            }
            finally
            {
                Console.WriteLine("finally");
                throw new Exception("2");
            }

        }

        public static void Step3()
        {
            try
            {
                Console.WriteLine("Step 3");
                throw new Exception("step 3");
            }
            finally
            {
                Console.WriteLine("Step 3 finally");
            }
        }
    }

and output:

Step 3
Step 3 finally
catch
finally
2

I do not understand what happened with exception throw new Exception("1");. Did it just disappear? Why?

I have read answer about specification but I'm not sure I understand what happened with throw new Exception("1"); Is it still in memory?

Alleshka
  • 11
  • 1

0 Answers0