Created
September 29, 2013 20:59
-
-
Save factormystic/6756490 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace FMUtils.FlexTreeView.Extensions | |
{ | |
public static class IEnumerableExtensions | |
{ | |
public static IEnumerable<T> Realize<T>(this IEnumerable<T> source, Action<T> action) | |
{ | |
foreach (T el in source) | |
action(el); | |
return source; | |
} | |
public static IEnumerable<T> Realize<T>(this IEnumerable<T> source, Action<T, int> action) | |
{ | |
var i = 0; | |
foreach (T el in source) | |
action(el, i++); | |
return source; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment