如何将XSD文件转换为C#类 [英] How can I convert an XSD file to C# Class

查看:76
本文介绍了如何将XSD文件转换为C#类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有XSD格式的文件.如何将其转换为C#类?

I have a file in XSD format. How can I convert it to a C# class?

我需要在其他Web应用程序中进行类引用,在这些Web应用程序中,我需要按照以下说明进行调用:

I need class reference in other web applications where I need to make post call as per below:

var res = client.Post<Customer>("/customers", c );

推荐答案

使用

Use the XML Schema Definition Tool xsd.exe found in your framework tools to convert your schema into a serializable class or dataset.

xsd file.xsd {/classes | /dataset} [/element:element]
         [/language:language] [/namespace:namespace]
         [/outputdir:directory] [URI:uri]

在示例中,C#类将与xsd工具在同一目录中生成:

And in example, whereas the C# class will be generated in the same directory as the xsd tool:

xsd /c YourFile.xsd

这篇关于如何将XSD文件转换为C#类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆