Is it possible to guarantee the value of what ToString for an enum will be?

Viewed 132

The database I am working with currently has a varchar field, and in my code I want to map the potential values to a enumeration like:

public enum UserStatus
{
    Anonymous,
    Enrolled,
    SuperUser
}

At the database level for this column, there is a constrain on it where the value has to be:

ANONYMOUS
ENROLLED
SUPERUSER

Is it possible for me to do:

UserStatus.SuperUser.ToString()

And have that value be SUPERUSER, and this be consistant and not screw up down the road?

3 Answers
Related