Skip to content

Instantly share code, notes, and snippets.

@mikeminutillo
Created January 24, 2014 05:04
Show Gist options
  • Save mikeminutillo/8592337 to your computer and use it in GitHub Desktop.
Save mikeminutillo/8592337 to your computer and use it in GitHub Desktop.
Evenly space columns for objects in LINQPad
object MultiColumn (params object[] values)
{
if(values.Length < 1) return null;
var width = 1m / values.Length;
return Util.RawHtml (
new XElement ("table",
new XElement("colgroup",
Enumerable.Repeat(1, values.Length).Select (e => new XElement("col", new XAttribute("style", String.Format("width: {0:0%}", width)))).ToArray()
),
new XElement ("tr", values.Select (v =>
new XElement ("td", XElement.Parse (Util.ToHtmlString (true, true, v)))
)
)
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment