How do I break out of a foreach
loop in C# if one of the elements meets the requirement?
For example:
foreach(string s in sList){
if(s.equals("ok")){
//jump foreach loop and return true
}
//no item equals to "ok" then return false
}
See Question&Answers more detail:os