I have a database with an status field that can keep the following values:
- 0 Registrado
- 1 Activo
- 2 Finalizado
- 3 Anticipado
- 4 Reestructurado
Of course I just keep the number in a tinyint datatype in my database. Then I need to query that table but the GUI must show string value and not numeric value.
What is the best way to achieve it? Should I use a Enum datatype or dictionary ? What would the advantages of using one over the other?
In addition, results will be shown in a datagrid
The approach I would take is
tinyintvalues into anenumDictionary<TheEnumType, string>which maps the values to the user stringFor example
Now you can easily convert between the DB value and the appropriate enum
Building up the mapping between the names can now be easily done with a
Dictionary<Names, string>.