从 XML 生成 C# 类 [英] Generate C# class from XML
本文介绍了从 XML 生成 C# 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以从 XML 文件生成 C# 类吗?
Can I generate a C# class from an XML file?
推荐答案
是的,通过使用 xsd.exe
D: emp>xsd test.xml
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'D: emp est.xsd'.
D: emp>xsd test.xsd /classes
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'D: emp est.cs'.
注意事项
Answer 如何在开发者命令提示符中更改目录到 d: emp 可能有用.
Answer how to change directory in Developer Command Prompt to d: emp may be useful.
如果为多维数组生成类,XSD.exe生成器有bug,但是有解决方法.
If you generate classes for multi-dimensional array, there is a bug in XSD.exe generator, but there are workarounds.
这篇关于从 XML 生成 C# 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文