How to add child element to XElement as a decoded string?

Krosterolent

New Member
I want to make pass this test. What should I use instead of Add method?\[code\][TestMethod]public void AddContentWithoutEncoding(){ var element = new XElement("Parent"); element.Add("<Son>5</Son>"); Assert.IsTrue(element.ToString() == "<Parent><Son>5</Son></Parent>");}\[/code\]With the current approach \[code\]element.ToString() = "<Parent><Son>5</Son></Parent>"\[/code\] that's obviously encoding tag content.I have a big constant string with tags which I need to add to XElement (because I use it feurther). And want to use some clever solution than \[code\]HttpUtility.HtmlDecode\[/code\] - just add the decoded string rather than decode the whole result after adding.Thanks!
 
Back
Top