检查while循环是否在C#的第一次迭代中

Ale*_*lig 0 c# while-loop

我如何检查它是否是我while loop在C#中的第一次迭代?

while (myCondition)
{
   if(first iteration)
     {
       //Do Somthin
     }

   //The rest of the codes
}
Run Code Online (Sandbox Code Playgroud)

Ale*_*son 8

bool firstIteration = true;
while (myCondition)
{
   if(firstIteration )
     {
       //Do Somthin
       firstIteration = false;
     }

   //The rest of the codes
}
Run Code Online (Sandbox Code Playgroud)