C#数组做参数问题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace test
{
class ArrayClass
{
static void PrintArray(string[] arr)
{
for (int i = 0; i < arr.Length; i++)
{
System.Console.Write(arr[i] + "{0}", i < arr.Length - 1 ? " " : "");
}
System.Console.WriteLine();
}
static void ChangeArray( string[] arr)
{
arr = (arr.Reverse()).ToArray();
PrintArray(arr);
System.Console.WriteLine("arr[0] is {0} in ChangeArray.", arr[0]);
// return arr;
}
static void ChangeArrayElements(string[] arr)
{
arr[0] = "Sat";
arr[1] = "Fri";
arr[2] = "Thu";
System.Console.WriteLine("arr[0] is {0} in ChangeArrayElements.", arr[0]);
}
static void Main()
{
// Declare and initialize an array.
string[] weekDays = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };