Best way to create a Unique ID field for an enum
- by jax
What is the best way to get a Unique ID from an ENUM that will stay consistent between repeated execution of the program?
Currently I am doing this manually by passing an ID to the enum constructor. I don't really want to do this is I can help it.
Another option would be to use a static field that gets incremented for each enum value. The problem is that if later I decide to move the enum fields around or delete some this will cause problems with my program as the ID will be saved into user preferences.
The ID can be any basic type or a String.