G
Guest
Hello, friends,
I defined an enum like the follows:
public enum OrderStatus
{
new,
paid,
processing,
shipped
}
In database, we save 0 for new, 1 for paid, etc.
However, when we display to users, we need to show new, paid, etc., i.e.,
the meaningful words, not numbers.
Do we have a quick way to do it? Thanks.
(I am using switch{} to conver numbers to words, but I believe there should
be a more elegant way to do this since I just use the same names which are
already defined in enum)
I defined an enum like the follows:
public enum OrderStatus
{
new,
paid,
processing,
shipped
}
In database, we save 0 for new, 1 for paid, etc.
However, when we display to users, we need to show new, paid, etc., i.e.,
the meaningful words, not numbers.
Do we have a quick way to do it? Thanks.
(I am using switch{} to conver numbers to words, but I believe there should
be a more elegant way to do this since I just use the same names which are
already defined in enum)