Storing variable value for lifetime in .Net?

与世无争的帅哥 提交于 2019-12-11 20:33:18

问题


I want to store a variable value that store its value life time.

I know the following things that can be used but it may have a storing limits.

  1. Session
  2. Cookie
  3. Query string

But I want to store value for lifetime.

I heard about "application variables", but I don't know about their functionality. So, could anyone tell me about it and also suggest me is there any other way to store values?


回答1:


Application is a key value dictionary of objects. Application state is stored in memory on the server and will be lost when application shutdown or crash. See this for more info.

If you want to store a value lifetime, I mean even when the Application crash or shutdown, you must use a database(it could be a xml file or structured file...).




回答2:


If it is regarding to the installtion of window applcation then you can add an entry in windows registry after finishing installation or at the time of running the application first time.

On the second installation you have to check that registry key.

Please refer Registory Handling



来源:https://stackoverflow.com/questions/15081074/storing-variable-value-for-lifetime-in-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!