Encode Xml - CSharp System.Xml

CSharp examples for System.Xml:XML String

Description

Encode Xml

Demo Code

// Licensed under the same terms of ServiceStack: new BSD license.
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from  w  w w . j a  v  a2 s  .c  o m

public class Main{
        public static string EncodeXml(this string value)
		{
			return value.Replace("<", "&lt;").Replace(">", "&gt;").Replace("&", "&amp;");
		}
}

Related Tutorials