Exemplo n.º 1
0
        public static IDataflowBlock LinkAsyncBlockWithSync <TInput, TOutput, TSource>(
            this ISourceBlock <Task <TInput> > asyncSourceBlock,
            Func <TInput, TOutput> transformSync,
            TaskCompletionSource <TSource> taskCompletionSource)
        {
            var newAsyncBlock = new TransformBlock <Task <TInput>, Task <TOutput> >(
                input => FuncHelper.WrapFuncWithCatch(transformSync, input, taskCompletionSource)
                );

            asyncSourceBlock.LinkDependingOnTaskState(newAsyncBlock, taskCompletionSource);

            return(newAsyncBlock);
        }