class Program
 { 
    static void Main(string[] args) 
    { 
         try 
         { 
             int value = int.Parse(" test exception"); 
          } 
         catch (Exception e)
         { 
                throw e; //  According to CLR, is the beginning of the exception located here?
               }
          } 
    }
 
Explanation
In case of "throw e" statement usage (with exception object being explicitly indicated) it is considered that this exception will be handled, so new object is created and all information about the initial exception occurrence reason (StackTrace) is lost.
In case of re-generation of an exception using "throw" statement the starting point in the stack is not reset, so the CLR considers that an exception occurred earlier in a stack.

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты