Hello everyone
Can anyone help me with codes to calculate sum of numbers in the diagonal of a 2 dimensional matrix array. Please help. (a b c d e
f g h i j
j k l m n
o p q r s)

int[,] array = new int[2, 4] { { 1, 2, 3, 4 }, { 1, 2, 3, 4 } };
List<int> list = new List<int>();
for (int i = 0; i < array.GetLength(1); i++)
{
int sum = 0;
for (int j = 0; j < array.GetLength(0); j++)
{
sum += array[j, i];
}
list.Add(sum);
}
//list now has all sums of 2-d array!
//result is: 2,4,6 and 8