using System;
class MainClass{
public static void Main() {
try {
int zero = 0;
Console.WriteLine("In try block: attempting division by zero");
int myInt = 1 / zero;
} catch (DivideByZeroException myException) {
Console.WriteLine("Message = " + myException.Message);
Console.WriteLine("StackTrace = " + myException.StackTrace);
}
}
}
In try block: attempting division by zero
Message = Attempted to divide by zero.
StackTrace = at MainClass.Main()