Easier way to serialize C# class as XML text

前端 未结 4 1353
醉梦人生
醉梦人生 2020-12-16 03:07

While trying to answer another question, I was serializing a C# object to an XML string. It was surprisingly hard; this was the shortest code snippet I could come up with:<

4条回答
  •  既然无缘
    2020-12-16 03:48

    Write an extension method or a wrapper class/function to encapsulate the snippet.

提交回复
热议问题