Declaring and Defining an Array

In certain respects, the array is very similar to the string type, which, for that reason, is often referred to as an array of characters. I expect you to be reasonably familiar with the string class by now and I will briefly use it here to familiarize you with the array concept.

Recall how a variable of type string is able to hold a collection of characters, all neatly ordered and indexed, facilitating easy access to each character as in

which assigns the letter i to ch. Or as in

which counts the number of bs in ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.