using System;
public class Number {
int[] arr = { 4, 7, 0, 6, 1, 8 };
public int GetNumber(int i) {
if (i < 0 || i >= arr.Length) {
throw new IndexOutOfRangeException();
}
return arr[i];
}
}
public class Program {
public static void Main() {
var o = new Number();
try {
Console.WriteLine(o.GetNumber(3));
Console.WriteLine(o.GetNumber(99));
}
catch (IndexOutOfRangeException ex) {
Console.WriteLine(ex.GetType().Name);
}
}
}
/*
run
6
IndexOutOfRangeException
*/