Smart    Lucky

Smart Lucky

  • NA
  • 555
  • 641.2k

Exception

Jul 8 2011 6:16 AM
hi Dudes

Can any one tell me can try block throw the more than one exception at a time... if is possible than how can handle them....?

like below program


using System;
class Test
{
    static void Main()
    {
        try
        {
            throw new DivideByZeroException();
            throw new IndexOutOfRangeException();
        }
        catch (DivideByZeroException e)
        {
            Console.WriteLine(e.Message);
        }
        catch (IndexOutOfRangeException s)
        {
            Console.WriteLine(s.Message);
        }
        Console.ReadKey();
    }
}

Answers (2)