protected override List <SessionReportIndicators> CombineChunkedIndicators(BlockingCollection <SessionReportIndicators> chunkedIndicators, CancellationToken cancellationToken) { var reports = new List <SessionReportIndicators>(); SessionReportIndicators report = null; foreach (var chunkedIndicator in chunkedIndicators.OrderByDescending(x => x.SessionEnd)) { if (cancellationToken.IsCancellationRequested) { return(reports); } if (report != null && chunkedIndicator.SessionEnd.HasValue && Utils.IsDateInDateRange(chunkedIndicator.SessionEnd.Value, report.SessionStart, report.SessionEnd, sessionInterval)) { report.AddIndicator(chunkedIndicator); continue; } report = chunkedIndicator; reports.Add(report); } return(reports); }
public void StartGame() //старт игры { foreach (var item in players) { item.number = rnd.Next(1, 1000); } winner = players.OrderByDescending(i => i.number).First(); //операция упорядочевания }
internal ICollection <WebAPIDto <TModel> > CurrentTenantExecutionWebAPI <TModel>(Func <TenantModel, ICollection <WebAPIDto <TModel> >, ICollection <WebAPIDto <TModel> > > func, Func <IEnumerable <WebAPIDto <TModel> >, ICollection <WebAPIDto <TModel> > > finalizeSearchLambda, string methodName) { string errorMessage = string.Concat("Errore nell'esecuzione del metodo ", methodName, " ."); BlockingCollection <WebAPIDto <TModel> > results = new BlockingCollection <WebAPIDto <TModel> >(); try { func(_tenant, new List <WebAPIDto <TModel> >()).ToList().ForEach(x => results.Add(x)); } catch (Exception ex) { FileLogger.Error(Logger, errorMessage, ex); throw new WebAPIException <ICollection <WebAPIDto <TModel> > >(ex.Message, ex) { Results = finalizeSearchLambda(results) }; } return(finalizeSearchLambda(results.OrderByDescending(x => x.TenantModel.CurrentTenant).ToList())); }