Vote count:
0
I'm having this part of code which I want to make smaller, more readable and easy to manage. Any thoughts? I tried linq but got lost.
foreach (var o in state.s)
{
TimeSpan timeDiff = (DateTime.Now - o.time);
if (timeDiff.TotalSeconds < 300)
{
richTextBox.AppendColoredText(o.name + " ", Color.Green);
}
else
{
richTextBox.AppendColoredText(o.name + " ", Color.Red);
if (f == false)
{
listA.Add(o.name);
listA_clone.Add(o.name);
}
else
{
listA.Add(o._name);
}
}
}
asked 2 mins ago
How to make this foreach code smaller
Aucun commentaire:
Enregistrer un commentaire