You must have a main class that launches your application such as Program.cs. If you add a private static variable and a public statuc 'get' property to that class it will be available throughout your application.
I.E. :
static class Program {
...
static private string m_UserCode = "";
...
static public string UserCode {
get {
return m_UserCode;
}
}
} // end of class Program
You can set the variable from within class Program but have a read only global value available.
If you need to set the UserCode from another class you could do it if you made the variable protected.
What you don't know can hurt you!
|