Question

I have a ASP.NET web application which has more than 100 pages. Each page is using some common values ( ex : current USDoller rate) .This can be changed at any time. Now I want to maintain this value in a single file so that i can change only her at any time to get it reflected throughtout the project.I dont want to store it in web config. I want to store it in some other place

Any thoughts ?

Was it helpful?

Solution

Make a static class like this:

public static class MyConsts {
   public const string Prefix = "n-";
}

From anywhere in your project use:

MyConsts.Prefix

(Note: const is implicitly static)

OTHER TIPS

My initial thoughts are one of the following:

  1. Store it in a database table and create a mechanism for editing the values
  2. Create a static class and store them there

Why not just make a static class and store the constants there. That way when you change it, everything will get the new values.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top