Bonjour j'aurais besoin d'aide pour trier une matrice par ses colonnes. Voici ce que j'ai essayé. Mais ça ne fonctionne pas et sa dit:exeption non géré.Je voudrais donc que ma matrice devienne {{7,8,24,33},{7,77,88,89}}

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public static void Main() {
            int[,] matA = new int[,] { { 33, 24, 7, 8 }, { 89, 77, 88, 7 } };
            int[] tab = new int[matA.GetLength(1)];
 
            for (int i = 0; i <= matA.GetLength(0); i++) {
                for (int j = 0; j <= matA.GetLength(1); j++) {
 
                    tab[j] = matA[matA.GetLength(i), j];
                    Array.Sort(tab);
                    foreach (int f in tab) Console.Write("{0,3}", f);
 
                } Console.WriteLine();
             }
}