public string GetRowString(int i = 0) { var maxWayLength = Ways.Max(way => WayToString(way).Length) + 2; return(string.Format("| {0, -5} | {1, " + -maxWayLength + "} | {2, -6} | {3, -6} |", i + 1, WayToString(Ways[i]), Sums[i], Budgets[i])); }
public void PrintTable() { var maxWayLength = Ways.Max(way => WayToString(way).Length) + 2; Console.WriteLine(); PrintBr(); Console.WriteLine(string.Format("| {0, -5} | {1, " + -maxWayLength + "} | {2, -6} | {3, -6} |", "Index", "Way", "Cost", "Budget")); PrintBr(); for (var i = 0; i < Ways.Count; i++) { if (i == IndexCrit) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(GetRowString(i)); Console.ForegroundColor = ConsoleColor.White; } else { Console.WriteLine(GetRowString(i)); } PrintBr(); } }