次の C# コード スニペット
では、' while
' ループ内に ' ' ループがあり、特定の条件が発生したときforeach
に ' ' 内の次の項目にジャンプしたいと考えています。foreach
foreach (string objectName in this.ObjectNames)
{
// Line to jump to when this.MoveToNextObject is true.
this.ExecuteSomeCode();
while (this.boolValue)
{
// 'continue' would jump to here.
this.ExecuteSomeMoreCode();
if (this.MoveToNextObject())
{
// What should go here to jump to next object.
}
this.ExecuteEvenMoreCode();
this.boolValue = this.ResumeWhileLoop();
}
this.ExecuteSomeOtherCode();
}
' ' は、' ' ループではなくcontinue
' ' ループの先頭にジャンプします。ここで使用するキーワードはありますか、それとも私があまり好きではない goto を使用する必要があります。while
foreach