Is it possible to transform following code to Linq that it will look like little bit more nicely
foreach (var entry in bottleneck.Item2)
{
if(entry.ChangeoverTime > 0)
{
avarangechangeOverTimes += entry.ChangeoverTime;
++counter;
}
if (entry.ChangeoverTime > maxchangeOverTimes)
{
maxchangeOverTimes = entry.ChangeoverTime;
}
changeovertime.ChangeoverTimes.Add
(
new ChangeOverDateValue
{
ChangeoverValue = entry.ChangeoverTime,
Color = ChangeOverTimeToColor(entry.ChangeoverTime),
StartTime = entry.StartTime
}
);
}
If the number of entries in
bottleneck.Item2isn’t huge, you could achieve the same using these three statements:Please note that this will enumerate
bottleneck.Item2three times instead of one time with your current code.