Xml literals escaping
I am somewhat bias towards C#, but one can admire the xml literals in vb.net.
This is a language feature where you can just add xml to
Dim someXml As XElement = <foo>bla<bar active=”false”/></foo>
But how do you add characters that have some a meaning in xml, like “&” or “<“. Turns out you have two options:
Look up how you should escape it (& => & ) but the editor (vs2013) will show wavy underlines underneath the literal. It will compile do and work as expected.
Embed a literal string
Dim someXml As XElement = <foo>Ampersand <%= “&” %><bar active=”false”/></foo>
this uses a method to embed expressions in xml literals.