Skip to content

Instantly share code, notes, and snippets.

@kleinron
Created May 12, 2023 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kleinron/6d197caff02801d34b4821975eef155d to your computer and use it in GitHub Desktop.
Save kleinron/6d197caff02801d34b4821975eef155d to your computer and use it in GitHub Desktop.
void Application_Start(object sender, EventArgs e)
{
MyGlobals.Wish.Value = 1234;
MyGlobals.Wall.Value = "numb";
}
public class MyGlobals
{
public static SafeValueSeldomWrites<int> Wish =
new SafeValueSeldomWrites<int>();
public static SafeValueSeldomWrites<string> Wall =
new SafeValueSeldomWrites<string>();
}
public partial class MyPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// get a value
int diamond = (int) Application["Wish"];
// set a value
Application["Wall"] = "numb";
}
}
protected void Page_Load(object sender, EventArgs e)
{
// get a value
int diamond = MyGlobals.Wish.Value;
// set a value
MyGlobals.Wall.Value = "Vera";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment