Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xsd.exe Auto-Implemented Properties

Tags:

c#

properties

xsd

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;
        }
    }
}
like image 860
Suchiman Avatar asked Jul 12 '13 09:07

Suchiman


1 Answers

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.

like image 69
Sergey Vyacheslavovich Brunov Avatar answered Sep 22 '22 00:09

Sergey Vyacheslavovich Brunov