} // forEach() public static void forEach <E>(IEnumerable <E> items, NConsumer <E> action) { foreach (E item in items) { try { action.accept(item); } catch (Exception e) { if (e is NRuntimeException) { throw (NRuntimeException)e; } throw new InvalidOperationException("Action threw exception", e); } } } // forEach()
} // map() // https://stackoverflow.com/questions/36449343/what-is-the-c-sharp-equivalent-of-java-8-java-util-function-consumer public static void forEach <E> (E[] items, NConsumer <E> action) { forEach(NArrays.AsList(items), action); } // forEach()