所以我有这几行代码:
string[] newData = File.ReadAllLines(fileName)
int length = newData.Length;
for (int i = 0; i < length; i++)
{
if (Condition)
{
//do something with the first line
}
else
{
//restart the for loop BUT skip first line and start reading from the second
}
}
我已经尝试过使用 goto,但是正如您所看到的,如果我再次启动 for 循环,它将从第一行开始。
那么如何重新启动循环并更改起始行(从数组中获取不同的键)?