Skip to content

Instantly share code, notes, and snippets.

@factormystic
Created September 29, 2013 20:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save factormystic/6756490 to your computer and use it in GitHub Desktop.
Save factormystic/6756490 to your computer and use it in GitHub Desktop.
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