using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ThrowExample { class Program { public static void DoSomething() { throw new Exception("Thrown on line 12."); } public static void LogException(Exception e) { _originalCaughtException = e; } public static void ExceptionRethrower() { try { DoSomething(); } catch (Exception e) { LogException(e); throw; } } static void Main(string[] args) { try { ExceptionRethrower(); } catch (Exception e) { Console.WriteLine(e); Console.WriteLine(object.ReferenceEquals(e, _originalCaughtException)); } Console.WriteLine("Done."); Console.ReadLine(); } public static Exception _originalCaughtException; } }