1.陣列排序

label1.Text = label2.Text = "";

int[] a = new int[] { 5, 6, 7, 8, 2, 9, 2, 2 };

foreach( int i in a){

label1.Text += i.ToString() + "\n";

}

Array.Sort(a);

foreach (int i in a)

{

label2.Text += i.ToString() + "\n";

}