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
Currently, enum members in generated C# code is converted into Pascal case by default
But in real world app we need the enum members to be mandatory named. Here are some possible senarios:
There is already a lot of data scattered everywhere in the system, including Database, csv file, json data, etc. To make ease for debugging and human-beings daily operation, the enum field is saved as string, not integer, in these data. Although there is an ignoreCase parameter of Enum.TryParse to make it possible to read string from data, the result of ToString will be different of the existing data, which introduces inconsistence into data.
Migrate some hand-written enums to protobuf. Same as above, we can do some renaming work before migrating, but it's almost impossible to apply the renaming on the existing data.
Suggested modification:
Add an option definition in descriptor.proto
Make a small change in csharp_enum.cc, generate enum member name by option
Of course this is not an C#-only problem, and maybe related to #1079
The text was updated successfully, but these errors were encountered:
Currently, enum members in generated C# code is converted into Pascal case by default
But in real world app we need the enum members to be mandatory named. Here are some possible senarios:
ignoreCase
parameter ofEnum.TryParse
to make it possible to read string from data, the result ofToString
will be different of the existing data, which introduces inconsistence into data.Suggested modification:
descriptor.proto
csharp_enum.cc
, generate enum member name by optionOf course this is not an C#-only problem, and maybe related to #1079
The text was updated successfully, but these errors were encountered: