Nullable value with xsd.exe generated class

前端 未结 3 1515
刺人心
刺人心 2021-02-19 04:45

I have been using xsd.exe to generate a class for deserializing XML into. I have decimal value in the source xsd that is not required:



        
3条回答
  •  别跟我提以往
    2021-02-19 05:17

    Currently it works as it should. I'm using xsd v2.0.50727.42 and:

    
    

    generates exactly what you've been looking for (without redundant ...Specified field and property):

    private System.Nullable portField;
    
    [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
    public System.Nullable Port {
        get {
            return this.portField;
        }
        set {
            this.portField = value;
        }
    }
    

提交回复
热议问题