xsd.exe 自动实现的属性 [英] xsd.exe Auto-Implemented Properties
本文介绍了xsd.exe 自动实现的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以强制 xsd.exe 生成自动实现的属性,而不是 xsd.exe 生成的难看的手动实现的代码?
Is it possible to force xsd.exe to generate auto-implemented properties instead of the ugly manually implemented code which xsd.exe generates?
public abstract partial class SomeClass {
private string valueField;
/// <remarks/>
[System.Xml.Serialization.XmlTextAttribute()]
public string Value {
get {
return this.valueField;
}
set {
this.valueField = value;
}
}
}
推荐答案
似乎 XML 架构定义工具 (Xsd.exe) 不支持生成自动实现的属性.
It seems XML Schema Definition Tool (Xsd.exe) does not support generating auto-implemented properties.
但还有一个替代方案:Xsd2Code 社区版.来自功能列表:
But there is an alternative: Xsd2Code community edition. From feature list:
在不需要特殊 get 或 set 时支持自动属性.
Support automatic properties when no special get or set is required.
相关答案:XSDObjectGen.exe vs XSD.exe.
这篇关于xsd.exe 自动实现的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文