Mega Code Archive

 
Categories / C# / Language Basics
 

Uses some of the properties of the Exception class

using System; using System.Reflection; public class Starter {     public static bool bException = true;     public static void Main() {         try {             MethodA();         } catch (Exception except) {             Console.WriteLine(except.Message);             bException = false;             except.TargetSite.Invoke(null, null);         }     }     public static void MethodA() {         if (bException) {             throw new ApplicationException("exception message");         }     } }