LSL.Enumerables.MarkdownTables
This library provides methods to generate a markdown table from a strongly typed IEnumerable<T>
The following example uses all the defaults:
var result = new List<KeyValuePair<string, string>>
{
new("Key1", "Value1"),
new("Key2", "Value2"),
new("Key3", null)
}.ToMarkdownTable();
/* result will contain:
| Key | Value |
| :---- | :------ |
| Key1 | Value1 |
| Key2 | Value2 |
| Key3 | `null` |
*/
Defaults
- All top-level public properties that are simple types are output
- Numbers are justified to the right.
- Header names are the names of each property
DateTimeandDateTimeOffsetproperties use theGformat string (e.g. en-GB would show20/02/2020 23:00:00for 20th Feb 2020 at 11PM)- If there is no time portion then the
dformat string is used to only output the date.
- If there is no time portion then the
- Numeric data types will use the
N2format string (e.g. en-GB would show2,123.22for a decimal value of2123.22)- all intrinsic integer values will use the
N0format string
- all intrinsic integer values will use the
nullvalues will be output as`null`