xsd.exe Auto-Implemented Properties

百般思念 提交于 2019-12-23 07:47:03

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!