uses some of the properties of the Exception class

image_pdfimage_print
   
 

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");
        }
    }
}