从XML生成C#类

我可以从XML文件生成C#类吗?

回答:

是的,通过使用xsd.exe

D:\temp>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:\temp\test.xsd'.

D:\temp>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:\temp\test.cs'.

回答如何将“开发人员命令提示符”中的目录更改为d:\ temp可能会有用。

如果为多维数组生成类,则XSD.exe生成器中存在错误,但是存在解决方法。

以上是 从XML生成C#类 的全部内容, 来源链接: utcz.com/qa/428614.html

回到顶部