日期:2014-05-17 浏览次数:20854 次
static void printarray(string[] S)
{
Console.Write("\nPrint Array:");
foreach (string item in S )
{
Console.Write("{0} ",item);
}
}
static void ChangeArray(string[] So)
{
//So = So.Reverse().ToArray();
So = (So.Reverse()).ToArray();
}
static void ChangeArrayElements(string[] Sor)
{
Sor[0] = "7";
Sor[1] = "6";
Sor[2] = "5";
}
private void button1_Click(object sender, EventArgs e)
{
string[] NumString = { "1", "2", "3", "4", "5", "6", "7" };
printarray(NumString); //output: Print Array:1 2 3 4 5 6 7
ChangeArray(NumString);
printarray(NumString); //Output:Print Array:1 2 3 4 5 6 7
ChangeArrayElements(NumString);
printarray(NumString); //Output:Print Array:7 6 5 4 5 6 7
}