public CorridorStatistics GetCorridorStats(int iterations) { if (iterations <= 0) { return(CorridorStatsArray.OrderBy(c => c.Iterations).Take(-iterations + 1).Last()); } var cs = CorridorStatsArray.Where(c => c.Iterations == iterations).SingleOrDefault(); if (cs == null) { GalaSoft.MvvmLight.Threading.DispatcherHelper.UIDispatcher .Invoke(new Action(() => { CorridorStatsArray.Add(new CorridorStatistics(this)); })); CorridorStatsArray.Last().Iterations = iterations; return(CorridorStatsArray.Last()); } return(cs); }
public IEnumerable <CorridorStatistics> GetCorridorStats() { return(CorridorStatsArray.OrderBy(cs => cs.Iterations)); }