开发者

How to create list of nums on the start of the project [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜