Mega Code Archive

 
Categories / C# / Language Basics
 

Exception Handling

using System; public class TryingCatching {     static int Zero = 0;     public static void Main()     {         // watch for exceptions here         try         {             int j = 22 / Zero;         }         // exceptions that occur in try are transferred here         catch (Exception e)         {             Console.WriteLine("Exception " + e.Message);         }         Console.WriteLine("After catch");     } }