Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Constant

Status
Not open for further replies.

crazyboybert

Programmer
Jun 27, 2001
798
GB
Hi all

I'm not sure this is possible but I thought it was worth asking. Is there a way to make a constant (in this case a string) available throughout a class library without it existing in a class or struct and therefore needing to instantiate an object to access it?

What I would like to do is have a global constant (like a key in web.config or an Application level variable in ASP.NET) that I can access throughout my class library. If I just declare a const variable directly in the namespace a build error is thrown as only class, delegate, interface, struct and enum are allowed directly within a namespace.

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Im going to be offline till next week on holiday :) so if I don't respond to this thread thats why. Thanks in advance to anyone who answers in the interim.

Cheers

Rob

Go placidly amidst the noise and haste, and remember what peace there may be in silence - Erhmann 1927
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top