class Host
{
public int[] a = {2,4,5,9,5,3,8,1 };
public void Sorting()
{
Array.Sort(a);//升序排列的方法
Array.Reverse(a);//把数组元素反向输出
}
}
主函数中这样写
Host ho = new Host();
ho.Sorting();
for (int i = 0; i < ho.a.Length; i++)
{
Debug.Log(ho.a[i]);
}