Пример #1
0
        /// <summary>
        /// Asynchronous executes the given callback method for all items in the collection and reports failures at the end.
        /// </summary>
        /// <typeparam name="T">Collection element type.</typeparam>
        /// <param name="collection">The collection.</param>
        /// <param name="continuation">The continuation to be invoked at the end of the iteration.</param>
        /// <param name="userCallback">The user callback.</param>
        /// <param name="logger">The logger to use for reporting.</param>
        public static void AsyncForEachWithDelayedFailures <T>(this IEnumerable <T> collection, IAsyncContinuation continuation, Action <T, IAsyncContinuation> userCallback, Logger logger)
        {
            var continuator = new Continuator <T>(collection.GetEnumerator(), userCallback, continuation, true, logger);

            continuator.ExecuteNextItem();
        }
Пример #2
0
        /// <summary>
        /// Asynchronous executes the given callback method for all items in the collection.
        /// </summary>
        /// <typeparam name="T">Collection element type.</typeparam>
        /// <param name="collection">The collection.</param>
        /// <param name="continuation">The continuation to be invoked at the end of the iteration of whenever
        /// the user callback returns an error.</param>
        /// <param name="userCallback">The user callback.</param>
        /// <remarks>The callback method should execute one of the methods on the passed continuation method to indicate
        /// that the execution should proceed to the next item.</remarks>
        public static void AsyncForEach <T>(this IEnumerable <T> collection, IAsyncContinuation continuation, Action <T, IAsyncContinuation> userCallback)
        {
            var continuator = new Continuator <T>(collection.GetEnumerator(), userCallback, continuation, false, Logger.Null);

            continuator.ExecuteNextItem();
        }