A New Internet Library: Add Your Website/Blog or Suggest A Website/Blog to our Free Web Directory http://anil.myfunda.net.

Its very simple, free and SEO Friendly.
Submit Now....

Sunday, May 24, 2009

"foreach" vs "ForEach"

A number of people have asked me why there is no Microsoft-provided "ForEach" sequence operator extension method. The List class has such a method already of course, but there's no reason why such a method could not be created as an extension method for all sequences. It's practically a one-liner:

public static void ForEach<T>(this IEnumerable<T> sequence, Action<T> action)
{ // argument null checking omitted
  foreach(...Full Article.

No comments:

Post a Comment

Post your comments here:

Originals Enjoy