参考代码:count为你要遍历的对象的长度for(int i=0;i{string[i]=value}yourlist为你要遍历的对象int i=0;foreach(string str in yourlist){string[i]=str;i++;}