match = null; foreach(var item in items) { foreach(var criterion in criteria) { if (!criterion.IsMetBy(item)) //如果不符合標(biāo)準(zhǔn) { //那么說明這個item肯定不是要查找的,那么應(yīng)該在外層循環(huán)執(zhí)行continue操作 } } match = item; break; }
match = null; foreach(var item in items) { foreach(var criterion in criteria) { if (!criterion.IsMetBy(item)) { goto OUTERCONTINUE; } } match = item; break;
match = null; foreach(var item in items) { foreach(var criterion in criteria) { HasMatch=true; if (!criterion.IsMetBy(item)) { // No point in checking anything further; this is not // a match. We want to “continue” the outer loop. How? HasMatch=false; break; } } if(HasMatch) { match = item; break; } }