03.01.2015 Views

Complete set: Intro to C - Bill Buchanan

Complete set: Intro to C - Bill Buchanan

Complete set: Intro to C - Bill Buchanan

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

and main properties are:<br />

IsFixedSize<br />

IsReadOnly<br />

Length<br />

Identifies if the array is a fixed size (get only)<br />

Identifies if the array is read‐only (get only)<br />

Identifies the length of the array (get only)<br />

Figure 3.1: System.Array<br />

C# contains the methods of the System.Array object. It also inherits the syntax of C<br />

for representing an array index, which uses square brackets <strong>to</strong> identify the element,<br />

such as:<br />

duction <strong>to</strong> .NET<br />

<strong>Intro</strong><br />

myArray[15];<br />

for the element number 15. Note that C# starts its indexing at 0, thus myArray[15] is<br />

the 16th element of the array. To declare an array:<br />

type[] arrayName;<br />

For example <strong>to</strong> declare an array of doubles:<br />

double[] inputValues;<br />

This declares the type of the array. To then <strong>to</strong> initialize it the following is used:<br />

Agilent .NET Course: Arrays and Collections 3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!