Created
January 24, 2014 05:04
-
-
Save mikeminutillo/8592337 to your computer and use it in GitHub Desktop.
Evenly space columns for objects in LINQPad
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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