예제 #1
0
        /// <summary>
        /// Post all given items to the actionBlock and return a task of the completion.
        /// </summary>
        public static Task PostAllAndComplete <T>(this ITargetBlock <T> actionBlock, IEnumerable <T> inputs)
        {
            Contract.Requires(inputs != null);

            foreach (T input in inputs)
            {
                actionBlock.PostOrThrow(input);
            }

            actionBlock.Complete();
            return(actionBlock.Completion);
        }