How to create list of nums on the start of the project [closed]
I've have such code:
namespace _namespace
{
public enum Enums
{
Value1 = 1,
Value2 = 2,
Value13 = 3,
...
Valuen = n
}
}
All this datum are already in database. All what 开发者_运维问答I need it's to create the list of enums on the start of the project.
P.S. It's web applicat
An Enum is not meant to be dynamic. This is not something that can/should be done in your application. You can create a Dictionary<int, string>
to work with your database values.
You can use T4 to generate the enum from a lookup table
http://erraticdev.blogspot.com/2011/01/generate-enum-of-database-lookup-table.html
精彩评论