天使半只翼

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
                System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(Hotel));
                using (System.IO.MemoryStream ms = new System.IO.MemoryStream())
                {
                    System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(ms, System.Text.Encoding.UTF8);
                    xs.Serialize(ms, h57);
                    writer.Close();
                    Response.Write(System.Text.Encoding.UTF8.GetString(ms.GetBuffer()));
                }

 

此方法不用写到硬盘,比较方便

posted on 2013-03-14 15:49  天使半只翼  阅读(311)  评论(0编辑  收藏  举报