You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The naming guidelines for Google Protobuf enums is to use the C++/Java standard
of all capitals:
enum MyEnum {
OPTION_ONE =1;
OPTION_TWO =2;
}
In .NET the naming standards are to use Pascal case (upper camel):
http://msdn.microsoft.com/en-us/library/4x252001(VS.71).aspx
Please include a ProtoGen setting that will convert enumerated values to the
.NET standard. Expected output would be:
enum MyEnum {
OptionOne,
OptionTwo
}
Original issue reported on code.google.com by [email protected] on 4 Jan 2013 at 6:40
The text was updated successfully, but these errors were encountered:
I was slightly surprised to see that we don't already do this. I'm pretty sure
we've got the relevant code already, as we convert field names appropriately.
I can't promise when I'll get to this, but it seems entirely reasonable as an
option.
Original comment by jonathan.skeet on 5 Jan 2013 at 8:54
Hi Jon
In addition to this option, I think it would be great to include another option
to remove the type name if it appears at the start of the enum value. This
goes back to the uniqueness rules for enum values following the C++ convention
in ProtoBuf. Because of these rules, developers tend to prefix the enum values
with the type name of the containing type (using the different naming
conventions):
enum MyEnum {
MY_ENUM_ONE = 1;
MY_ENUM_TWO = 2;
}
It would be nice to include an additional option that would clear up the
generated C# enum and remove the type name prefix where it matches the
containing type:
enum MyEnum {
One,
Two
}
It's a pity the original proto C++ compiler didn't just add this prefix in the
generated C++ code and made the enum values unique to the containing type.
Yes, that makes sense too, and I should be able to do it as part of the same
set of changes. As I say, don't hold your breath for it, but it shouldn't be
too hard when I find time :)
Original comment by jonathan.skeet on 5 Jan 2013 at 7:46
Original issue reported on code.google.com by
[email protected]
on 4 Jan 2013 at 6:40The text was updated successfully, but these errors were encountered: