What if you want to add one more day? Usually, you can't, and you may say: "why would I want to do that?". Well, let's say we just want to. If you are interested about my use case, see at the end.
"Why would I want to do that?. Well, let's say we just want to."
Huh? The author provides no reason to do this except for hack effect. 22 lines of code written to subvert the type safe enum pattern and it gets 7 up votes? People - work with me here.
Instead of hacking - if you have a List of things that might be variable you might try using - say - a List? Just a suggestion.
By definition a Enum is something which is finite and that will not change. The developer is going to use it and this allow him not to use another value than the one define in the enum...
I can't see the point, adding a value dynamicly during at execution time.
Comments
raveman replied ago:
unit testing for enums will be crazy.
sproketboy replied ago:
"Why would I want to do that?. Well, let's say we just want to."
Huh? The author provides no reason to do this except for hack effect. 22 lines of code written to subvert the type safe enum pattern and it gets 7 up votes? People - work with me here.
Instead of hacking - if you have a List of things that might be variable you might try using - say - a List? Just a suggestion.
fluminis replied ago:
I don't understand why he woud do such a thing.
By definition a Enum is something which is finite and that will not change. The developer is going to use it and this allow him not to use another value than the one define in the enum...
I can't see the point, adding a value dynamicly during at execution time.
Voters For This Link (9)
Voters Against This Link (2)