using System; class MainClass { static void Main() { try { int y = 0; y = 10/y; } catch (DivideByZeroException e) { Console.WriteLine("Message: {0}", e.Message); Console.WriteLine("Source: {0}", e.Source); Console.WriteLine("Stack: {0}", e.StackTrace); } } }
Message: Attempted to divide by zero. Source: main Stack: at MainClass.Main()