Monday, April 23, 2012

C#: Array.Sort method for double?

I have an array ( double ) : ox_test with a known number of elements.



when I code :



Array.Sort(ox_test);



and then, just to see if the array it's sorted :



for (int y = 1; y <= ox_test.Length; y++)
MessageBox.Show(".x: " + ox_test[y]);


.. I get ... 0, 0, 0, 0, 0 ( if the number of elements was 5 ). Please help, thank you!



So i modified the both for loops:



for (int y = 0; y < ox_test.Length; y++)



            MessageBox.Show(".x: " + ox_test[y]);


// HERE i get the values not sorted but != 0



        Array.Sort(ox_test);


for (int y = 0; y < ox_test.Length; y++)



            MessageBox.Show(".x s: " + ox_test[y]);


// HERE i get only 0 values





No comments:

Post a Comment