c# - Flags with web services -


I have a flag attribute animation that is behind the web service:

  [serialable] , Flags] Public Enum AccessLevels {None = 0, Read = 1, Write = 2, Full = Read | My problem is that the consumer of my web service is not the original stable value of enum. As a result, there is something in the proxy class side that is equivalent to doing this:  
  {none = 1, read = 2, write = 4, full = 8}  

and thus when the consumer is checking "read" access , It will also be false when "Test itam" is "full"

  ((testItem & Svc.Read) == Svc.Read)  
< P> How can I provide flags on a web service correctly Huh?

Edit:

According to the article it is not possible to do what I am looking for to do Ivan Krivyakov states

Enums incomplete Transparency

It has been found that enums are not as transparent as we want them to be. There are three sticky problems:

  1. If the server-side code declares an NM and specifies specific numeric values ​​to its members, then this value will not be visible to the customer.
  2. If the server-side code declares "flag" anem with "compound" mask values ​​(white = red | green | blue), then it does not appear properly on the client side.
  3. If the server or client transmits an "invalid" value which is outside the enum's dimension, on the other hand the XML de-serializer causes an exception.

So I wonder if this is just a limit and it is not possible.

I have done extensive research on this and have found that it can be used to calculate the computation constant through a web service. It is not possible to sort. Note that you do not need an enumeration or to complete your goal. These two enumeration can be rooted with a combination of reading / writing:

If your AccessLevels = Read | Write and none if your AccessLevels = 0 [none]

Your enumeration will look like this:

  [serializable, flag] public Enum AccessLevels {Read = 1, Write = 2}  

Comments