开发者

Namespace recommendations for holding enumerations?

Well i have just been through my rather large project and used correct namespacing (within the naming conventions) so i have things like Models, Service, UI etc.... all the standard stuff..

AND I HAVE DRAWN A BLANK :-)!!

I have quite a few enumerations, constants and things like that which i need to extract them from a generic class i have and insert them into a class/project of there own so i can add a reference to it from all my projects that need it.

Can anyone suggest a good naming convention for holding enumerations and constants etc.. I t开发者_运维技巧hought about using CompanyName.Product.Enumerations but there again its NOT just enumerations..

I was hoping for a little input or advise and good namespace naming structure for this sort of project (holding enumeration, collections, and constants)

Thanks in advance


The enumerations should live in the same namespace as the types that use them - don't create namespaces that organize things by how they are designed.

Just think - would you create namespaces like this?

Comp.Project.Classes
Comp.Project.Structs
Comp.Project.Interfaces

No, because that doesn't mean anything and provides no contextual information about the types that are contained there. Enums are just like any other type - they belong in a namespace that has contextual meaning to the enum itself.


well, usually I would recommend against seperating them. The same resons apply as why I don't like "toolbox" projects that end up as a code-dump.

Can't you simply let your other projects reference your current assembly? It sounds like you are seperating elements that are vital to your Business Rules, why not draw the name from that area?


Maybe some something like CompanyName.Product.Reference as assemblyname, then specify further using Reference.Constants, Reference.Enums etc?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜