数组示例
2012-04-24 22:11 精诚所至 金石为开 阅读(449) 评论(0) 编辑 收藏 举报创建一个包含三个元素的字符串数组,并输出。
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(); } } }
![](https://img2024.cnblogs.com/blog/35695/202407/35695-20240713070336838-1837943664.jpg)