110,571
社区成员
发帖
与我相关
我的任务
分享
String[] sArr = new String[] {"one","two","three","four" };
foreach (String s in sArr)
Console.WriteLine(s);
String[] sArr = new String[] {"one","two","three","four" };
foreach (String s in sArr)
Console.WriteLine(s);
list<string> str=new list<string>();
//向集合str中添加元素
for(int i=0;i<10;i++)
{
str.add(i.ToString());
}
//输出str集合中的元素
foreach(string item in str)
{
response.write(item);
}
int[] datas = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
foreach (int item in datas)
{
Console.WriteLine(item.ToString());
}
//和下面是等效的
IEnumerator ed = datas.GetEnumerator();
while (ed.MoveNext())
{
Console.WriteLine(ed.Current.ToString());
}