Bounds Checking - CSharp Language Basics

CSharp examples for Language Basics:Array

Introduction

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

Related Tutorials