How to maintain my data like a session variable in .NET Windows Forms?
I am using .NET Windows Forms. I need to maintain some date to check the condition. So I have to maintain it until the user logs out.
Like session in ASP.NET.
How can I do this? (Note it should not expire until the user logs out.)
Update:
I create Namespace like this
namespace nsGlobalData {
class GlobalData
{ public static int GlobalOrgId; }
}
To Set:
Glob开发者_如何学GoalData.GlobalOrgId = Convert.ToInt16(ds.Tables[1].Rows[0].ItemArray[0]);
ToGet
txtnamt.text=GlobalData.GlobalOrgId;
class Program
{
internal static Dictionary<string, object> GlobalVariables = new Dictionary<string, object>();
static void Main(string[] args)
{
...
}
}
Just use a static variable in some class?
精彩评论