<!--<br /> <br /> Code highlighting produced by Actipro CodeHighlighter (freeware)<br /> http://www.CodeHighlighter.com/<br /> <br /> -->
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArrayOperation
{
class Program
{
static void Main(string[] args)
{
int [] a = { 123 , 12 , 245 , 1 , 2 , 45 , 67 }; // 一维数组,类型为int
int [,] b = { { 12 , 34 , 1 , 7 },{ 23 , 345 , 12 , 45 }}; // 二维数组,类型为int
string[] c = { " hello " , " World " , " 你好 " }; // 一维数组,类型为string
foreach ( int i in a) { // 输出a数组
System.Console.Write( " {0} " ,i);
}
System.Console.WriteLine(); // 换行
foreach ( int j in b){ // 输出b数组
System.Console.Write( " {0} " , j);
}
System.Console.WriteLine(); // 换行
foreach (string j in c){ // 输出c数组
System.Console.Write( " {0} " , j);
}
System.Console.ReadLine(); // 方便看结果,免得结果一闪而过
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ArrayOperation
{
class Program
{
static void Main(string[] args)
{
int [] a = { 123 , 12 , 245 , 1 , 2 , 45 , 67 }; // 一维数组,类型为int
int [,] b = { { 12 , 34 , 1 , 7 },{ 23 , 345 , 12 , 45 }}; // 二维数组,类型为int
string[] c = { " hello " , " World " , " 你好 " }; // 一维数组,类型为string
foreach ( int i in a) { // 输出a数组
System.Console.Write( " {0} " ,i);
}
System.Console.WriteLine(); // 换行
foreach ( int j in b){ // 输出b数组
System.Console.Write( " {0} " , j);
}
System.Console.WriteLine(); // 换行
foreach (string j in c){ // 输出c数组
System.Console.Write( " {0} " , j);
}
System.Console.ReadLine(); // 方便看结果,免得结果一闪而过
}
}
}