DEV Community

Cover image for C# Foreach Loop Through Array
Bradley Wells
Bradley Wells

Posted on • Originally published at wellsb.com on

C# Foreach Loop Through Array

An important advantage of arrays in C# is the ability to use a loop or loop to cycle through the elements of the array. Suppose you have declared an array of integers and you want to know which variable contains a specific value. Because your data is structured in an array, you can loop through the array’s elements in order to find the value you are interested in. There are two approaches...

Source

Oldest comments (0)