using System;
using System.Collections.Generic;
namespace RSG.Promises {
///
/// General extensions to LINQ.
///
public static class EnumerableExt {
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++;
}
}
///
/// Convert a variable length argument list of items to an enumerable.
///
public static IEnumerable FromItems(params T[] items) {
foreach (var item in items) {
yield return item;
}
}
}
}