Category Archives: Code Snippets

Loop Through The Diagonal Elements In Two Dimensional Array

Advertisement from Google If you need to only loop through the diagonal elements of the two-dimensional array you can use the following C# code (but should be more or less the same for any programming language): int width = 5; int height = 17; bool[,] array = new bool[width, height]; var ratio = width /… Read More »