How do we check Array out of range error in C#

 Posted by Chvrsri on 1/25/2012 | Category: C# Interview questions | Views: 5356 | Points: 40

In C# we have IndexOutOfRange exception which is used to check the index out of range exception.


catch(IndexOutOfRangeException ex)
Console.WriteLine("An index was out of range!");
catch(Exception ex)
Console.WriteLine("Error occured: " + ex.Message);

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response