C#自动生成的XSD类的对象自动生成、对象、XSD

2023-09-07 00:48:22 作者:裸奔的青春丶

我创建一个XML文件,并有一个XSD文件对着干。

I'm creating an xml file and have an XSD file to work against.

我敢肯定,我记得读书的地方,在给定的XSD C#可以自动地创建类的对象。所以,如果我有一个XML元素的地址,我可以有一个使用XSD创建类的必需属性生成的C#类。

I'm sure I remember reading somewhere that C# can automagically create class objects when given an XSD. So if I have an address element in XML I can have a generated C# class that uses the xsd to create the required properties of the class.

例如<联系地址><后code>< /后code><电话>< /电话>

将映射到一类称为地址与性能张贴code和电话。

would map to a class called Address with properties postcode and phone.

是这样的事情可能还是我的梦想呢?

Is this sort of thing possible or did I dream it?

推荐答案

使用的 XSD.EXE 在.NET SDK。

use xsd.exe in the .net sdk.

使用/ C开关生成类