public void Calculate() { bool equals = true; string name = ""; foreach (Tournament t in list) { if (name == "") { name = t.Type; } if (t.Type != name) { equals = false; break; } } if (equals) { int first = 0; int second = 0; int other = 0; foreach (Tournament t in list) { switch (t.Place) { case 1: first++; break; case 2: second++; break; default: other++; break; } } Tournament firstPlace = list.FirstOrDefault(t => t.Place == 1); if (firstPlace != null) { lblFirst.Text = string.Format("First place (+${0:F2}). Count - {1}; In total: +${3:F2}; {2:F2}%", firstPlace.Earnings - firstPlace.Buy_in, first, (double)first * 100 / list.Count, (firstPlace.Earnings - firstPlace.Buy_in) * first); } Tournament secondPlace = list.FirstOrDefault(t => t.Place == 2); if (secondPlace != null) { lblSecond.Text = string.Format("Second place (+${0:F2}). Count - {1}; In total: +${3:F2}; {2:F2}%", secondPlace.Earnings - secondPlace.Buy_in, second, (double)second * 100 / list.Count, (secondPlace.Earnings - secondPlace.Buy_in) * second); } Tournament otherPlace = list.FirstOrDefault(t => t.Place != 1 && t.Place != 2); if (otherPlace != null) { lblOther.Text = string.Format("Other place (-${0:F2}). Count - {1}; In total: -${3:F2}; {2:F2}%", otherPlace.Buy_in, other, (double)other * 100 / list.Count, otherPlace.Buy_in * other); } } }