How do we check Array out of range error in C#
Ans)
In C# we have IndexOutOfRange exception which is used to check the index out of range exception.
Example:
Ans)
In C# we have IndexOutOfRange exception which is used to check the index out of range exception.
Example:
try
{
------
}
catch(IndexOutOfRangeException ex)
{
Console.WriteLine("An index was out of range!");
}
catch(Exception ex)
{
Console.WriteLine("Error occured: " + ex.Message);
}
0 comments: