close
文章出處
//對象序列化xml
OutModel outmodel = new OutModel(); XmlSerializer serializer = new XmlSerializer(typeof(OutModel)); using(MemoryStream ms = new MemoryStream())
{ serializer.Serialize(ms, outmodel);
return Content(System.Text.Encoding.UTF8.GetString(ms.ToArray()), "text/xml");
}
//加載XML及反序列化
XmlDocument xdc = new XmlDocument(); xdc.Load(url); XmlSerializer ser = new XmlSerializer(typeof(InModel)); StringReader sr = new StringReader(xdc.InnerXml); InModel docmodel = ser.Deserialize(sr) as InModel;
不含病毒。www.avast.com |
全站熱搜
留言列表