Esempio n. 1
0
            protected override async Task <T[]> ExecuteInner(RunContext runContext, CancellationToken cancellationToken)
            {
                var instructionAwaiter = MultipleTaskAwaiter.Make(this.responders
                                                                  .Select((responder, i) => responder
                                                                          .Execute(runContext, cancellationToken)
                                                                          .WithIndex(i)));

                var results = new T[this.responders.Count];

                while (instructionAwaiter.HasNext)
                {
                    var indexedInstruction = await instructionAwaiter.AwaitNext();

                    var result = await indexedInstruction.Value
                                 .Execute(runContext, cancellationToken)
                                 .WithIndexFrom(indexedInstruction);

                    Indexed.AssignToArray(results, result);
                }

                return(results);
            }