I have an enum, NewEnum
, which needs to be exactly equal to another enum, OldEnum
. It seems I can't define an alias for an enum (or something equivalent) so I decided it would be easiest to simply re-define all the states.
Let's say OldEnum
is defined as:
public enum OldEnum {
a,
b,
c,
}
Currently, I have NewEnum
defined as:
public enum NewEnum {
a = OldEnum.a,
b = OldEnum.b,
c = OldEnum.c,
}
Since it's annoying to have to both update OldEnum
and NewEnum
when I want to add a new state, I was wondering if there was a way to dynamically have the same states in NewEnum
as OldEnum
.
Note that this doesn't need to be done at runtime (reflection shouldn't be used), just at compile-time