2
Reply

Exception

Smart    Lucky

Smart Lucky

Jul 8 2011 6:16 AM
1.3k
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)