-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum key stripping #461
Comments
This can be achieved via remapping today. A new option to explicitly trim out some prefixes would also be possible, but there are many cases this won't work. This includes where the prefix is non-obvious, where it is instead a common postfix, where the first letter after the prefix is a number, etc. I'll leave this open and up-for-grabs in case someone wants to do it, but I expect it would need to look like: Alternatively, or in addition, the existing |
In many cases the prefix is the enum member type name. So, in order to keep it simple, I suggest I am working on this now, will submit PR soon. |
It's worth noting one of the "best" ways to consume these types is simply to do This is ultimately very consistent with C/C++ (which can help with porting) and fits in if C# ever gets the proposed feature to allow contextual access to enum members without having to qualify the type name. |
Could you add an option to strip the prefix from the enumeration keys. For example given following C code:
enum abc_some_enum { abc_some_enum_key1, abc_some_enum_key2, abc_some_enum_key3, };
The expected C# output is following:
My best guess is that generator should cut maximum common prefix from the enum key name.
The text was updated successfully, but these errors were encountered: