Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to return to the top of a foreach loop
Message
De
26/01/2007 12:24:59
 
 
À
22/01/2007 17:02:04
John Baird
Coatesville, Pennsylvanie, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01185290
Message ID:
01189711
Vues:
15
I wonder if it's not just a matter of semantics - or how one thinks about it?

static void Main(string[] args)
{
int[] aryInts = new int[5] { 0, 1, 2, 3, 4 };

foreach (int j in aryInts) {
if (j == 3) {
Console.WriteLine("Three.");
}
}
foreach (int j in aryInts)
{
if (j != 3)
{
continue; //Skips to closing foreach brace then returns to top
}
Console.WriteLine("Three too!");
}

}
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform