Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class EnumerableExtensions{
- public static int ForEach<T>(this IEnumerable<T> input, Action<T> toRunAct)
- {
- int iterations = 0;
- if (input == null) return iterations;
- foreach (var put in input)
- {
- if (!put.Equals(default(T)))
- {
- toRunAct(put);
- iterations++;
- }
- }
- return iterations;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement