Azure Table Storage, WCF Service and Enum

后端 未结 6 1018
故里飘歌
故里飘歌 2021-02-19 09:00

Here\'s my problem. A class which defines an order has a property called PaymentStatus, which is an enum defined like so:

    public en         


        
6条回答
  •  佛祖请我去吃肉
    2021-02-19 09:19

    Parvs solution put me on the right track but I had some minor adjustments.

    private string _EnumType;
    private EnumType _Type;
    
    //*********************************************
    //*********************************************
    public string EnumType
    {
        get { return _Type.ToString(); }
        set
            {
                _EnumType = value;
                try
                {
                    _Type = (EnumType)Enum.Parse(typeof(EnumType), value);     
                }
                catch (Exception)
                {
                    _EnumType = "Undefined";
                    _Type = [mynamespace].EnumType.Undefined;                  
                }                        
            }
        }
    

提交回复
热议问题