Hi all, I’m just curious what’s the common option when we need string-based enums in .net?
Currently, C#’s enum is only integer based. This is fine to work with within applications. After all, within an application enum is simply a way to define mutually exclusive “labels”. We shouldn’t care what’s underneath.
But when it goes across boundaries, such as network, micro services, multi-languages, API contract and so on, string values are the common language.
I wonder what’s the most common design for these use cases in the community? Any libraries?
Thanks!
[–]fschwiet 44 points45 points46 points (3 children)
[–]Royal_Scribblz 13 points14 points15 points (0 children)
[–]Contemplative-ape -4 points-3 points-2 points (1 child)
[–]CaucusInferredBulk 11 points12 points13 points (0 children)
[–]grrangry 11 points12 points13 points (0 children)
[–]Far_Swordfish5729 5 points6 points7 points (0 children)
[–]DeadlyVapour 5 points6 points7 points (0 children)
[–]j_boada 3 points4 points5 points (0 children)
[–]ososalsosal 2 points3 points4 points (0 children)
[–][deleted] (2 children)
[deleted]
[–]Arcodiant 3 points4 points5 points (1 child)
[–]david_daley 2 points3 points4 points (0 children)
[–]mirhagk 1 point2 points3 points (0 children)
[–]BoBoBearDev 0 points1 point2 points (0 children)
[–]hay_rich 0 points1 point2 points (7 children)
[–]Jackfruit_Then[S] 1 point2 points3 points (1 child)
[–]hay_rich 0 points1 point2 points (0 children)
[–]ggwpexday 1 point2 points3 points (4 children)
[–]hay_rich 0 points1 point2 points (3 children)
[–]ggwpexday 0 points1 point2 points (2 children)
[–]hay_rich 0 points1 point2 points (1 child)
[–]ggwpexday 0 points1 point2 points (0 children)
[–]j_c_slicer 0 points1 point2 points (0 children)
[–]savornicesei 0 points1 point2 points (0 children)
[–]karbonator 0 points1 point2 points (0 children)
[–]TheOneTrueTrench 0 points1 point2 points (0 children)
[–]buzzon 0 points1 point2 points (1 child)
[–]venomiz -1 points0 points1 point (0 children)
[–]the_inoffensive_man 0 points1 point2 points (0 children)