使用xml序列化 一个对象
private void outObjectAsXml(object o)
{
System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(o.GetType(), "http://feedsky.com/0.2/service");
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xw.Formatting = Formatting.Indented;
xs.Serialize(xw, o);
lt_output.Text = HttpUtility.HtmlEncode(sw.ToString()).Replace("\n", "<br/>").Replace(" "," ") ;
}
没有评论:
发表评论