CSharp examples for Custom Type:try catch finally
Using Multiple catches for a Single try
using System;/*from w w w . j av a2 s .c om*/ class CatchIndex { public static void Main() { int [] myArray = new int[5]; try { for ( int i = 0; i < 10; i++ ) // Array only has 5 elements! { myArray[i] = i; } } catch (IndexOutOfRangeException e) { Console.WriteLine( "You were very goofy trying to use a bad array index!!", e); } catch (Exception e) { Console.WriteLine("Exception caught: {0}", e); } Console.WriteLine("\nDone with the catch statements. Done with program."); } }