You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
528 B

using System;
using System.Collections;
using System.Collections.Generic;
public static class IEnumeratorExtensions
{
/// <summary>
/// Loops through all items in a a collection and applies an action to them
/// </summary>
/// <param name="collection">collection to loop through</param>
/// <param name="action">Action to apply</param>
public static void ForEach<T>(this IEnumerable<T> collection, Action<T> action)
{
foreach (var item in collection)
action(item);
}
}