using System;
using System.Collections.Generic;
using System.Text;
namespace Test
{
class Program
{
static void Main(string[] args)
{
string[] t =new string[]{"C","Sh","a","rp"};
for(string i=0;i<t.Length;i++)
{
Console.Write(t[i]+" ");
}
Console.WriteLine();
foreach (string x in t)
{
Console.Write(x+" ");
}
Console.WriteLine();
}
}
}
运算符和实际有差别
string[] t =new string[]{"C","Sh","a","rp"};
for(int i=0;i<t.Length;i++) //string定义字符串
{
Console.Write(t[i]+" ");
}
Console.WriteLine();
foreach (int x in t) //string定义字符串
{
Console.Write(x+" ");
}
Console.WriteLine();