コード例 #1
0
        private static async Task Test()
        {
            IQueueWriter queueWriter = new FakeQueueWriter();
            var          enumerable  = Enumerable.Range(1, 100).Select(i => $"Messsage {i}");

            await enumerable.SafeParallelAsync(async msg => await queueWriter.Write(msg));
        }
コード例 #2
0
        private static async Task Test2()
        {
            IQueueWriter queueWriter       = new FakeQueueWriter();
            var          enumerable        = Enumerable.Range(1, 100).Select(i => $"Messsage {i}");
            var          cancellationToken = new CancellationToken();

            await enumerable.SafeParallelAsync(async msg => await queueWriter.Write(msg), cancellationToken : cancellationToken);
        }