#119 – Arrays

An array in C# is a type that contains a list of items of the same type.  Elements in the list can be referenced by a single variable name and a numerical index.  The first element is accessed using an index value of 0.

For example, below we define a four element array of integer (int) and set its elements to some hard-coded values.

 int[] numbers = new int[4];    //  Declare/create 4-element array of int

 // Set 4 elements to integer values
 numbers[0] = 10;    // 1st element
 numbers[1] = 20;
 numbers[2] = 30;
 numbers[3] = 40;

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers