Is there an equivalent to the continue statement in ForEach method?
List<string> lst = GetIdList();
lst.ForEach(id =>
{
try
{
var article = GetArticle(id);
if (article.author.contains("Twain"))
{
//want to jump out of the foreach now
//continue; **************this is what i want to do*******
}
//other code follows
}
EDIT: Thanks for all the great answers. And thank you for the clarification that .foreach is not an extension method. I use this structure to keep the coding style consistent (a different programmer worked on another similar method in the same class)...and thanks for the links to why to avoid using .foreach.