将xml 写到内存中再已string类型读出来

System.IO.MemoryStream ms = new System.IO.MemoryStream();
xmlDoc.Save(ms);
System.IO.StreamReader sr = new System.IO.StreamReader(ms, System.Text.Encoding.UTF8);
ms.Position = 0;
string xmlString = sr.ReadToEnd();

posted @ 2017-04-17 16:36  恋之呓  阅读(237)  评论(0编辑  收藏  举报