-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathArray1.cs
More file actions
34 lines (29 loc) · 783 Bytes
/
Array1.cs
File metadata and controls
34 lines (29 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
namespace Examples {
class Program {
// The main entry point for the application.
public static void Main() {
// make a single dimension array
int[] myArray1 = new int[5];
// make a 3 dimensional array
int[,,] myArray2 = new int[5, 3, 2];
// make an array with initialiser list
int[] myArray3 = { 10, 20, 30, 40, 50, 60, 70 };
int index = 0;
// show the array values
Console.WriteLine("The Array contains the following values:");
foreach (int value in myArray3)
Console.WriteLine("[{0}] {1}", index++, value);
}
}
}
// This code produces the following output:
//
// The Array contains the following values:
// [0] 10
// [1] 20
// [2] 30
// [3] 40
// [4] 50
// [5] 60
// [6] 70