public static string ToXml<T>(this T o) where T : new()
{
        string retVal;
        using (var ms = new MemoryStream())
        {
              var xs = new XmlSerializer(typeof (T));
               xs.Serialize(ms, o);
               ms.Flush();
               ms.Position = 0;
               var sr = new StreamReader(ms);
               retVal = sr.ReadToEnd();
        }
        return retVal;
}

 

相关文章:

  • 2022-02-01
  • 2022-12-23
  • 2021-06-12
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
猜你喜欢
  • 2021-05-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案