Tag Archives: C#

A simple exception handling using C#

By | April 23, 2011

Hi, See how a very simple exception handling works with try-catch methods using C#. [csharp] using System; class MainClass{ public static void Main(){ int divOne = 0; try { int ans = 79 / divOne ; } catch (Exception e) { Console.WriteLine("You got the exception-> " + e.Message); } } } [/csharp] Output- “You got the exception-> Attempted… Read More »