using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public static class IEnumerableExtension
{
public static void DoAll(this IEnumerable collection, Action action)
{
for (int index = 0; index < collection.Count(); index++)
{
T item = collection.ElementAt(index);
action(item);
}
}
public static void TryDoAll(this IEnumerable collection, Action action)
{
DoAll(collection, param =>
{
try
{
action(param);
}
catch (System.Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
});
}
}