Blue,
If the values are constants, then you can declare public constants on a
class and then they can be accessed anywhere that the class is available.
If you need to do some computation before setting the read-only variable
(for example, say you want to store the machine name, it can't be a
constant, but it is constant throughout the lifetime of the app). You can
set these variables in a static constructor for your type.
Which class you do it in is up to you. Global is a choice. As long as
it is visible to the other types that want to access it.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"blue" <bl**@arizona.edu> wrote in message
news:eO**************@TK2MSFTNGP12.phx.gbl...
I know, I know, global variables are bad bad bad.
I have some readonly variables that I assign right away and they will
never change (hence the "readonly" part). I need to access these variables in
multiple classes and I don't want to have multiple declaractions all over
the place and have to remember where to update everything when I decide to
change a value in my code.
Where/how do you do this? Since I'm using ASP.NET, maybe I could put them
in the global.asax? That sounds like a really bad idea though.