how can i sort a 2D int array in c#
<p>so i just started c# and found an exercise that says to sort the numbers in the array from small to big without using another array or change it to a 1D array this is what i did yet it does not work </p>

<p><img src="https://i.stack.imgur.com/NX7mA.png" alt="enter image description here"></p>

<pre><code>     for (int i = 0; i &lt; 3; i++)
        {
            for (int j = 0; j &lt; 4; j++)
            {
                Min = test[i, j];
                int o = 0;
                lign = i;
                col = j;
                for (int h = i; h &lt; 3; h++)
                {

                    for (int z = j; z &lt; 4; z++)
                    {
                        if (test[h, z] &lt; Min)
                        {
                            Min = test[h, z];
                            lign = h;
                            col = z;
                            o = 1;
                        }
                    }
                }
                if (o == 1)
                {
                    temp = test[i, j];
                    test[i, j] = test[lign, col];
                    test[lign, col] = temp;
                }

            }
        }
</code></pre>