C
Christopher
This secenario has come up several times in my career and I've seen
several ways of doing it.
Usually, I wonder why enums were used in the first place, when perhaps
some other contruct could have been easier to follow. However, given
that you have some enumeration type, how do you personally choose to
map it to a corresponding constant string?
1) I've seen a function or method at the same scope containing a large
switch
2) I've seen the enumeration ordered such that each is an index to an
array of corresponding strings
3) ...etc.
several ways of doing it.
Usually, I wonder why enums were used in the first place, when perhaps
some other contruct could have been easier to follow. However, given
that you have some enumeration type, how do you personally choose to
map it to a corresponding constant string?
1) I've seen a function or method at the same scope containing a large
switch
2) I've seen the enumeration ordered such that each is an index to an
array of corresponding strings
3) ...etc.