namespace DataTablePrettyPrinter { using System; using System.Data; using System.Linq; /// /// An extension class providing utility methods for pretty printing to a string. /// internal static class DataRowExtensions { /// /// Gets the width (in characters) of this row as it would appear on the pretty printed table by aggregating /// the widths of each individual column. /// /// /// /// The input row. /// /// /// /// The width (in characters) of this row. /// internal static int GetWidth(this DataRow row) { return row.Table.Columns.Cast().Aggregate(0, (a, c) => a + c.GetWidth() + 1) - 1; } /// /// Gets the height (in characters) of this row as it would appear on the pretty printed table by aggregating /// the heights of each individual column. /// /// /// /// The input row. /// /// /// /// The height (in characters) of this row. /// internal static int GetHeight(this DataRow row) { return 1; } } }