One-dimensional Array Example in C#.
namespace CsharpCode
{
class Program
static void Main(string[] args)
//Creating an array with size 3
int[] arr = new int[3];
//accessing array values using loop
//Here it will display the default values
//as we are not assigning any values
for (int i = 0; i < 3; i++)
Console.Write(arr[i] + " ");
}
Console.WriteLine();
int a = 0;
//Here we are assigning values to array using for loop
a += 10;
arr[i] = a;
//accessing array values using foreach loop
foreach (int i in arr)
Console.Write(i + " ");
Console.ReadKey();