Tuesday, July 29, 2008

c# windows form store global data

Using the following Class, you can store somethings you need cross forms.
Pretty handy sometimes instead of using Setting in C#. Setting creates visible config file
and it's pretty slow to read and write.



class GlobalData
{
private static GlobalData _instance = new GlobalData();
private string _formString = "";

static GlobalData()
{
}

public static GlobalData GetInstance()
{
return _instance;
}

public string TokenString
{
get
{
return _formString;
}
set
{
_formString = value;
}
}
}



No comments: