/// <summary>Add resultsToAdd to results.</summary>
 /// <param name="resultsToAdd">The results To Add.</param>
 /// <param name="groupSelector">The group Selector.</param>
 /// <returns>The grouped result</returns>
 public static IEnumerable <TimeMeasureResult> Group(this IEnumerable <TimeMeasureResult> resultsToAdd, Func <TimeMeasureResult, string> groupSelector)
 {
     return
         (resultsToAdd
          .GroupBy(groupSelector)
          .Select(s => new TimeMeasureResult
     {
         IdParts = WebGreaseContext.ToIdParts(s.Key),
         Count = s.Min(m => m.Count),
         Duration = s.Sum(m => m.Duration)
     })
          .OrderByDescending(r => r.Duration)
          .ToArray());
 }
Esempio n. 2
0
 /// <summary>Gets the measure results for this timer.</summary>
 /// <returns>The measure results.</returns>
 public TimeMeasureResult[] GetResults()
 {
     return
         (this.measurements.Last().OrderByDescending(m => m.Value)
          .Select(
              m =>
              new TimeMeasureResult
     {
         IdParts = WebGreaseContext.ToIdParts(m.Key),
         Duration = m.Value,
         Count = this.measurementCounts.Last()[m.Key]
     })
          .ToArray());
 }