我如何检查它是否是我while loop在C#中的第一次迭代?
while (myCondition)
{
if(first iteration)
{
//Do Somthin
}
//The rest of the codes
}
Run Code Online (Sandbox Code Playgroud)
bool firstIteration = true;
while (myCondition)
{
if(firstIteration )
{
//Do Somthin
firstIteration = false;
}
//The rest of the codes
}
Run Code Online (Sandbox Code Playgroud)