Class TableParser
Formats data as string tables with automatically calculated column widths based on content.
public static class TableParser
- Inheritance
-
TableParser
- Inherited Members
Methods
ToStringTable(List<string>, IList<List<string>>)
Converts headers and rows into a formatted string table by flattening into a two-dimensional array
public static string ToStringTable(List<string> headers, IList<List<string>> rows)
Parameters
Returns
- string
Formatted string table
ToStringTable(string[,])
Converts a two-dimensional string array into a formatted string table with column alignment
public static string ToStringTable(this string[,] tableValues)
Parameters
tableValuesstring[,]Two-dimensional array of string values
Returns
- string
Formatted string table with header separator
ToStringTable<T>(List<T>, List<string>, params Func<T, object>[])
Converts a list of objects into a formatted string table using the specified column headers and value selectors
public static string ToStringTable<T>(this List<T> values, List<string> columnHeaders, params Func<T, object>[] valueSelectors)
Parameters
valuesList<T>List of objects to display as rows
columnHeadersList<string>Headers for each column
valueSelectorsFunc<T, object>[]Functions to extract column values from each object
Returns
- string
Formatted string table
Type Parameters
TType of the objects in the list
ToStringTable<T>(T[], string[], params Func<T, object>[])
Converts an array of objects into a formatted string table using the specified column headers and value selectors
public static string ToStringTable<T>(this T[] values, string[] columnHeaders, params Func<T, object>[] valueSelectors)
Parameters
valuesT[]Array of objects to display as rows
columnHeadersstring[]Headers for each column
valueSelectorsFunc<T, object>[]Functions to extract column values from each object
Returns
- string
Formatted string table
Type Parameters
TType of the objects in the array