Nullable value with xsd.exe generated class

前端 未结 3 1512
刺人心
刺人心 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:19

    I've just noticed that it has actually included the following code:

    private bool balanceFieldSpecified;
    
    [System.Xml.Serialization.XmlIgnoreAttribute()]
    public bool BalanceSpecified {
        get {
            return this.balanceFieldSpecified;
        }
        set {
            this.balanceFieldSpecified = value;
        }
    }
    

    Which provides the functionality I need.

    I'll leave the question open for a while in case there is an elegant way to make use of nullable? type instead.

提交回复
热议问题