Pickaxe.Program.Measure C# (CSharp) Method

Measure() private static method

private static Measure ( RuntimeTable result ) : List
result RuntimeTable
return List
        private static List<int> Measure(RuntimeTable<ResultRow> result)
        {
            var lengths = new List<int>();
            lengths.Add(1);

            foreach (var column in result.Columns()) //headers
                lengths.Add(Truncate(column).Length + 2);

            for (int row = 0; row < result.RowCount; row++)
            {
                if ((row+1).ToString().Length+2 > lengths[0])
                    lengths[0] = (row+1).ToString().Length+2;

                for (int col = 0; col < lengths.Count - 1; col++)
                {
                    int len = Truncate(result[row][col].ToString()).Length + 2;
                    if (len > lengths[col+1])
                        lengths[col+1] = len;
                }
            }

            return lengths;
        }