c# - Is it possible for a 'foreach' loop to have a condition check? -


if have foreach loop, there way check boolean well?

i don't want check once inside foreach() , break example. want foreach on collection , @ same time evaluate if true.

for example, don't want do:

    ienumerable<job> jobs = currentjobs;      foreach(job job in jobs)     {         if (found)              break;     } 

you turn loop.

for (i = 0; < jobs.count && booleantrue; i++) {  // lot of great stuff } 

you need change jobs ienumerable ilist. think ilist serve purposes better. ienumerable lazy evaluates elements before need them , doesn't include associated collection helper methods.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -