O'Reilly logo

C# Primer Plus by Klaus Michelsen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing Individual Array Elements

An individual array element is accessed in the same manner as an individual character of a string variable—by writing the array variable name followed by a pair of square brackets containing the index value of the element. The following line

accountBalances[0] = 1000m;

assigns the value 1000 of type decimal to the first element of array elements contained in the object referenced by accountBalances. The index can be any numerical expression with a non-negative value of a type implicitly convertible to type int, and must be evaluated to a value less than the length of the array.

Note

The index values of the individual ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required