Skip to content

Instantly share code, notes, and snippets.

@binki
Last active January 4, 2017 17:18
Show Gist options
  • Save binki/9d09ea0ae8ea43788505af08844dae79 to your computer and use it in GitHub Desktop.
Save binki/9d09ea0ae8ea43788505af08844dae79 to your computer and use it in GitHub Desktop.
<x y="uh, 5">
<child1 />hi. 2×4=8<child2 c2a1="non-interpolated $tring{}" /></x>
using System;
using System.Xml.Linq;
class XElementDemo
{
static void Main(string[] args)
{
var tree = new XElement(
"x",
new XAttribute("y", $"uh, {1+4}"),
new XElement("child1"),
$"hi. 2×4={2*4}",
new XElement(
"child2",
new XAttribute("c2a1", "non-interpolated $tring{}")));
Console.WriteLine(tree);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment