2012年4月25日星期三

数组示例

数组示例

创建一个包含三个元素的字符串数组,并输出。

using System;namespace a{	class Program	{		public static void Main(string[] args)		{			string[] friendNames={"Robert Barwell","Mike Parry","Jeremy Beacock"};			int i;			Console.WriteLine("Here are {0} of my friends:",friendNames.Length);			for(i=0;i<friendNames.Length;i++)			{				Console.WriteLine(friendNames[i]);			}			Console.ReadKey();		}	}}

TAG:C#