Table of Contents

Class TableParser

Namespace
SunamoCl.SunamoCmd.Tables
Assembly
SunamoCl.dll

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

headers List<string>

Column header names

rows IList<List<string>>

Rows of data as lists of strings

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

tableValues string[,]

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

values List<T>

List of objects to display as rows

columnHeaders List<string>

Headers for each column

valueSelectors Func<T, object>[]

Functions to extract column values from each object

Returns

string

Formatted string table

Type Parameters

T

Type 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

values T[]

Array of objects to display as rows

columnHeaders string[]

Headers for each column

valueSelectors Func<T, object>[]

Functions to extract column values from each object

Returns

string

Formatted string table

Type Parameters

T

Type of the objects in the array