I've got the following class:
public static class Pages { public static string LoggedOut = "LoggedOut.aspx"; public static string Login = "Login.aspx"; public static string Home = "Home.aspx"; } I know I can use Pages.Home statically, but there is a reason for my question.
I wish to have a method that I can call like this:
string pageName = Pages.GetPage("Home"); etc.
C'est possible?
Thanks, Dave
readonlyor use read-only properties instead.constshould be avoided, if possible, for the values are not runtime-constant, but compiletime. If you are using privateconstfields this should not be a problem, but if you are referencing an assembly and useconstfields of one of the classes in the assembly, the value is replaced by the literal value of theconstfield. If you now change the value and just replace the referenced assembly without recompiling the referencing assembly the old value remains in the referencing assembly, which will most likely lead to an undesired behavior.