class Static Algorithm
25 {
26 public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
27 {
28 foreach (T obj in collection)
29 {
30 action(obj);
31 }
32 }
33
34 public static void ForSpecification<T>(this IEnumerable<T> collection, Action<T> action, Predicate<T> filter)
35 {
36 foreach (T obj in collection)
37 {
38 if (filter(obj))
39 action(obj);
40 }
41 }
42 }
15 var numbers = new [] {"hello", "world", "Linq"};
16
17 numbers.ForEach (delegate(string str) // equal to Algorithm.ForEach(numbers,...)
18 {
19 Console.WriteLine(str);
20 }
21 );
I simply want to say I am all new to weblog and honestly loved your web blog. Most likely I’m likely to bookmark your site . You definitely come with really good article content. Kudos for revealing your webpage.
Wonderful blog! I found it while searching on Yahoo News. Do you have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thanks