Don't do this. You're assuming that ParityEven is always going to be the latest member of the enum, which might change unexpectedly in the future. It's much better to list all possible valid values instead, especially in this case, since there aren't so many of them.