| NiceFormatterTablize Method |
Converts an enumerable set of objects (of the same type) into a mock table of rows and columns formatted using ASCII
box characters. Each property in the incoming object type becomes a column of the mock table. The first row of the
mock table is a header row containing the column property names.
Namespace: Orthogonal.Common.BasicAssembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-15 18:00 GMT+10.f27da1471008deaf16b803c17e24a5955690aef1
Syntax public static IEnumerable<string> Tablize(
this IEnumerable<Object> source,
int? maxColLen = null,
int? maxRows = null
)
Parameters
- source IEnumerableObject
- An enumerable set of objects which must be the same Type.
- maxColLen NullableInt32 (Optional)
- Optional maximum length of text in each mock column.
- maxRows NullableInt32 (Optional)
- Optional maximum number of mock rows to process.
Return Value
IEnumerableStringAn enumerable set of text lines that display as a mock table using box ASCII characters.
Control characters in the displayed values are replaced with a small box U+25AB.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableObject. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Example var list = Process.GetProcesses().Take(5).Select(p => new { p.ProcessName, p.Id, p.WorkingSet64, p.BasePriority });
string[] lines = NiceFormatter.Tablize(list).ToArray();
foreach (var line in lines) Console.WriteLine(line);
┌─────────────┬─────┬──────────────┬──────────────┐
│ ProcessName │ Id │ WorkingSet64 │ BasePriority │
├─────────────┼─────┼──────────────┼──────────────┤
│ Idle │ 0 │ 8192 │ 0 │
│ System │ 4 │ 3895296 │ 8 │
│ Registry │ 124 │ 70713344 │ 8 │
│ smss │ 480 │ 544768 │ 11 │
│ csrss │ 616 │ 4100096 │ 13 │
│ wininit │ 704 │ 4116480 │ 13 │
└─────────────┴─────┴──────────────┴──────────────┘
See Also