Every programmer should use these simple extension methods to make their loops easier to read.
///
/// ForEach extension method for strongly typed IEnumerables
///
public static void ForEach(this IEnumerable source, Action action)
{
foreach (T item in source) action(item);
}
///
/// ForEach extension method for IEnumerables
///
public static void ForEach(this IEnumerable source, Action action)
{
foreach (T item in source) action(item);
}
0 comments:
Post a Comment