 | NiceFormatter.Tablize 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: 2025-03-15 14:42 GMT+11
Syntaxpublic static IEnumerable<string> Tablize(
this IEnumerable<Object> source,
int? maxColLen = null,
int? maxRows = null
)
Parameters
- source IEnumerable<Object>
- An enumerable set of objects which must be the same Type.
- maxColLen Nullable<Int32> (Optional)
- Optional maximum length of text in each mock column.
- maxRows Nullable<Int32> (Optional)
- Optional maximum number of mock rows to process.
Return Value
IEnumerable<String>An 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
IEnumerable<Object>. 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).
Examplevar 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