using System; using System.Collections.Generic; namespace ZenFulcrum.EmbeddedBrowser.Promises { /// /// General extensions to LINQ. /// public static class EnumerableExt { public static IEnumerable Empty() { return new T[0]; } public static IEnumerable LazyEach(this IEnumerable source, Action fn) { foreach (var item in source) { fn.Invoke(item); yield return item; } } public static void Each(this IEnumerable source, Action fn) { foreach (var item in source) { fn.Invoke(item); } } public static void Each(this IEnumerable source, Action fn) { int index = 0; foreach (T item in source) { fn.Invoke(item, index); index++; } } } }