uses some of the properties of the Exception class : Exception Class : Language Basics C# Source Code


Custom Search

C# Source Code » Language Basics » Exception Class »

 

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

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Language Basics
» Exception Class