.NET字符串数组拆分成多个字符串数组再循环遍历
因为传参时候,报数组参数过大,只能拆分成几个小数组
List<string> dduserlist = new List<string>();//存放钉钉的钉钉ID集合。超级长的数组
List<List<string>> data = new List<List<string>>();
int group = 6;//分成6个数组
int count = dduserlist.Count / group;//新数组分多少个元素
for (int i = 0; i < group; i++)
{
List<string> lst = new List<string>();
for (int j = i * count; j < i * count + count; j++)
{
lst.Add(dduserlist[j]);
}
if (i == group - 1)
{
for (int j = i * count + count; j < dduserlist.Count; j++)
{
lst.Add(dduserlist[j]);
}
}
data.Add(lst);
}
for (int i01 = 0; i01 < data.Count; i01++)
{
for (int i02 = 0; i02 < data[i01].Count; i02++)
{
reqtest.UserIds = data[i01];//data[i01]就是大数组拆后的小数组
}
}