Below code shows how to use foreach loop statement to iterate an array in c#/csharp –
using System;
namespace kodehelp.csharp.basic
{
public class ForeachLoop
{
public static void Main(string[] args)
{
Console.WriteLine("Argument size: " + args.Length);
foreach (string arg in args) {
Console.WriteLine("Argument: " + arg);
}
}
}
}