foreach loop string c# code example Example: syntax foreach loop C# foreach (type variableName in arrayName) { // code block to be executed }