问:关于Array.Sort()方法的使用
请问Array.Sort()方法能够对整数类型的数组进行排序吗?
还有为什么这段代码有错误
using System;
namespace ArrayTest
{
/// <summary>
/// Class1 の概要の説明です。
/// </summary>
class Class1
{
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
public static void PrintMyArray(object[] theArray)
{
foreach (object obj in theArray)
{
Console.WriteLine("Value:{0}",obj.ToString());
}
Console.WriteLine("\n");
}
static void Main(string[] args)
{
//
// TODO: アプリケーションを開始するコードをここに追加してください。
//
string [] myArray1={"my","who","is"};
int [] myArray={3,5,1,11};
PrintMyArray(myArray);
Array.Reverse(myArray);
PrintMyArray(myArray);
Array.Sort(myArray);
PrintMyArray(myArray);
Console.ReadLine();
}
}
}