Skip to content

Instantly share code, notes, and snippets.

View chhaugen's full-sized avatar

Carl Henning Haugen chhaugen

  • Norway, Viken
View GitHub Profile
@jsmarble
jsmarble / DataTable.AsMarkdownTable.cs
Last active January 2, 2025 14:10
Extension method to turn a DataTable into a Markdown table
public static StringBuilder AsMarkdownTable(this DataTable source)
{
StringBuilder sb = new StringBuilder();
foreach (DataColumn column in source.Columns)
sb.Append("|").Append(column.ColumnName.Trim());
sb.AppendLine("|");
for (int i = 0; i < source.Columns.Count; i++)