public static void LoopWithPointer <T>(this IList <T> l, IteratorWithPointer <T> iter) { for (int i = 0; i < l.Count; ++i) { iter(l[i], i, i == 0, i == l.Count - 1); } }
public static void LoopReverse <T>(this IList <T> l, IteratorWithPointer <T> iter) { for (int i = (l.Count - 1); i >= 0; --i) { iter(l[i], i, i == 0, i == l.Count - 1); } }