C#代码解释一下

来源:百度知道 编辑:UC知道 时间:2024/06/05 14:49:00
using System;
class Test{
static void Main(String[] args){
string[] strings = {“a”,”b”,”c”};
foreach(string info in strings){
Console.Write(info);
}
}
}

using System;
class Test{ //类
static void Main(String[] args){ //静态有一个掺数无返回的方法
string[] strings = {“a”,”b”,”c”}; // 定义字符串数组并赋值;
foreach(string info in strings){ //循环 把数组中的变量全部赋给info
Console.Write(info);循环输出;
}
}
}
结果是
a
ab
abc

字符串数组"a","b","c"
循环输出字符串strings