[protobuf] Re: C# Enum Flags

2015-11-25 Thread Jon Skeet
On Tuesday, 24 November 2015 19:36:11 UTC, Teddy Zhang wrote: > > How do I store a HashSet with protobuf? > Have a repeated field of the enum type, so that you get a collection - and then make sure you transform it into a set in your code. proto doesn't have the notion of a set as such. > Reg

[protobuf] Re: C# Enum Flags

2015-11-24 Thread Teddy Zhang
How do I store a HashSet with protobuf? Regarding the proto2 implementation, if I defined my enum as 1, 2, 4 etc, and I set the enum to value 3 (combination of 1 & 2), it serialize the fields correctly. But when deserialize, I get value 0 back (as 3 is not in enum). On Tuesday, November 24, 20

[protobuf] Re: C# Enum Flags

2015-11-24 Thread Jon Skeet
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 usi