I wasn't anticipating doing so, no. Aside from anything else, it would be different from all the other platforms - you'd only end up with a useful enum in C# if the developer creating the proto did exactly the right thing... and that would look odd for other developers.
I would suggest just using a HashSet<YourEnumType> instead for a set - just like there's EnumSet in Java which is a set of values. (I'm not sure what you mean by "current implementation is forbidden values that are combinations" - you can certainly define enums with values of 1, 2, 3, 4, 5 etc in proto2). Jon On Tuesday, 24 November 2015 00:52:53 UTC, Teddy Zhang wrote: > > C# supports Enum Flags, which is a nice feature. > > [Flags] >> enum MyColor >> { >> None = 0, >> Black = 1, >> Red = 2, >> Green = 4, >> Blue = 8 >> }; > > > However, protobuf seems doesn't support it. There is no way to define a > Flags for an enum. > Also, for protobuf2, it seem current implementation is forbidden values > that are combinations (e.g. 3). In that case it will treat it like unknown > fields. > In current protobuf 3 c# implemention, the restriction seems gets removed. > However, there is still no way to define the enum as Flags. > > In Java we also have EnumSet to give similar functionality. > > Will Protobuf C# implementation support this in the future? > > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscr...@googlegroups.com. To post to this group, send email to protobuf@googlegroups.com. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.