CSharp examples for Language Basics:Array
All array indexing is bounds-checked by the runtime.
An IndexOutOfRangeException is thrown if you use an invalid index:
int[] arr = new int[3]; arr[3] = 1; // IndexOutOfRangeException thrown