I donโt think that what you are trying to do is reasonable at all - do you have any reason to expect that you will not run into a scenario where you always get an exception at a certain iteration?
Anyway, to do what you want to do without goto , look at this:
foreach (String b in bar) { while(!DidSomethingWithThisString(b)) ; } bool DidSomethingWithThisString(string b) { try { } catch (EndpointNotFoundException ex) { return false; } return true; }
jball source share