Flags with web services

后端 未结 4 1203
灰色年华
灰色年华 2021-01-05 14:08

I have a flag attribute enumeration that is behind a web service as follows:

[Serializable,Flags]
public enum AccessLevels
{
    None = 0,
    Read = 1,
             


        
4条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-05 14:28

    Flags should be multiples of two, and in your case your flags are (0,1,2,3). Try change your definition of the struct to:

    [Serializable,Flags]
    public enum AccessLevels{    
    None = 1,    
    Read = 2,    
    Write = 4,    
    Full = Read | Write}
    

    And see if it works better.

    (I hope Im not making a fool of myself, its late and Im on my way to the bed.. )

提交回复
热议问题