You can try:
collection.first(x=> {
first / rest will look like this:
FirstPart<T> first<T>(this IEnumerable<T> c, Action<T> a) { return new FirstPart<T>(c, a); } FirstRest rest<T>(this FirstPart<T> fp, Action<T> a) { return new FirstRest(fp.Collection, fp.Action, a); }
You will need to define the classified FirstPart and FirstRest. FirstRest will need a run method (e.g. Collection, FirstAction and RestAction):
void run() { bool first = true; foreach (var x in Collection) { if (first) { FirstAction(x); first = false; } else { RestAction(x); } } }
Scott Wisniewski Dec 08 '10 at 17:30 2010-12-08 17:30
source share