简体   繁体   English

将类转换为xml的最佳方法是什么,反之亦然

[英]what is the best way to convert a class to xml and vice versa

what is the best way to convert a class to a XML and vice versa? 将类转换为XML的最佳方法是什么,反之亦然?

I want to convert my class to xml for using XRule and I want to convert back it to class with early type of properties. 我想将我的类转换为xml以使用XRule ,我想将它转换回具有早期类型属性的类。

thanks 谢谢

You can use XML Serialization to easily go from a class to XML, and the reverse. 您可以使用XML序列化轻松地从类转换为XML,反之亦然。 This tutorial does a good job explaining how to do it, and how to finely craft the resulting XML. 本教程很好地解释了如何执行此操作,以及如何精细地处理生成的XML。

XRule sounds like it plays a similar role as an XML Schema (I'm not familiar with it). XRule听起来像是一个与XML Schema类似的角色(我不熟悉它)。 The XML Schema Definition (xsd.exe) tool allows you to generate common language runtime classes from XML files and vice-versa. XML Schema Definition(xsd.exe)工具允许您从XML文件生成公共语言运行时类,反之亦然。 More info can be found here . 更多信息可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM