Tag Archives: enumerate

Use the yield statement in C#

An enumeration is a sequence of values that a program can enumerate over, for example, by using a foreach loop. In C# you can use the yield statement to make a method that returns an enumeration. The method that builds … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , | Leave a comment

Loop over an array of unknown dimension in C#

The previous post Loop over entries in an array of unknown length in C# explains how to loop over the entries in a one- or two-dimensional array, but what do you do if you don’t know how many dimensions an … Continue reading

Posted in algorithms, arrays, recursion, variables | Tagged , , , , , , , , , , , , , , , , | 1 Comment

Loop over entries in an array of unknown length in C#

One way to loop through the items in an array is to hard code its length into the program. Alternatively you can use the array’s Length property to determine how many items it contains at runtime. Then if you later … Continue reading

Posted in arrays, variables | Tagged , , , , , , , , , , , , | Leave a comment