CSharp examples for System.Xml:XML Element
Add Xml Content to XElement
using System.Linq; using System.Text; using System.Collections.Generic; using System.Globalization; using System.Xml.Linq; using System;//from ww w . j av a2 s.com public class Main{ public static XElement AddXmlContent(this XElement self, object contentValue) { self.Add(new XText(contentValue.ToXmlValue())); return self; } public static string ToXmlValue(this object self) { return Convert.ToString((self ?? String.Empty), CultureInfo.InvariantCulture); } }