问题
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;
}
}
}
回答1:
It seems XML Schema Definition Tool (Xsd.exe) does not support generating auto-implemented properties.
But there is an alternative: Xsd2Code community edition. From feature list:
Support automatic properties when no special get or set is required.
Related answer: XSDObjectGen.exe vs XSD.exe.
来源:https://stackoverflow.com/questions/17612252/xsd-exe-auto-implemented-properties