match = null; foreach(var item in items) { foreach(var criterion in criteria) { if (!criterion.IsMetBy(item)) //如果不符合标准 { //那么说明这个item肯定不是要查找的,那么应该在外层循环执行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; } }