Hi,
I have some constants that I would be using to specify some
properties.
I found it hard to use enums for this purpose and feel more
comfortable using a static class that would have static properties
returning the constants.
What is THE RIGHT WAY to do it?
Thnx
Right way? It depends.
If you are talking a "property bag" type setup, having a static class,
or perhaps a singleton, works nicely. If they are different for each
user, you can use session, or at least cache by session id, etc.
If they are truly constants for the app, spinning up a singleton for the
application settings is very nice, as it is quite clean. You can then
deploy more as needed, with application deployment of course.
You can also have your singleton derive from a dictionary, or similar,
and spin it up from config files or database at startup.
The point? The correct answer depends on the use and scope of the items.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************