public static void Main()
int[,] IndexTmp = new int[4, 2] { { 3, 1 }, { 1, 4 }, { 4, 6 }, { 7, 8 } };
for (ki = 0; ki < klength - 1; ki++)
for (kj = ki + 1; kj < klength; kj++)
if (IndexTmp[kt, 0] > IndexTmp[kj, 0]) kt = kj;
IndexTmp[ki, 0] = IndexTmp[kt, 0];
IndexTmp[ki, 1] = IndexTmp[kt, 1];
Console.WriteLine("OLD ------------------");
for (ki = 0; ki < klength; ki++)
Console.WriteLine("condition: " + IndexTmp[ki, 0] + " -- index:" + IndexTmp[ki, 1]);
Console.WriteLine("New ------------------");
int[] indexes = new int[4] { 1, 4, 6, 8 };
int[] conditions = new int[4] { 3, 1, 4, 7 };
Array.Sort(conditions, indexes);
for (var i = 0; i < 4; i++)
Console.WriteLine("condition : " + conditions[i] + " ------ index: " + indexes[i]);