winform应用程序数据持久性(C#) [英] WinForm App Data Persistance (C#)
问题描述
我beleive在ASP.NET应用程序变量的短期持久性的最佳方法是:
I beleive the best ways of "variable short term" persistance in an ASP.NET application are:
- 会话变量(会话范围)
- 应用程序变量(适用范围)
- 页面视图(页范围)
- 应用程序设置(应用程序范围)
- ???
- Sessions Variable (Session Scope)
- Application Variable (Application Scope)
- Page View (Page Scope)
- Application Settings (Application Scope)
- ???
什么是变短期的最佳途径持久性在Windows窗体应用程序:
What are the best ways of "variable short term" persistance in a windows form application for:
- 表范围
- 用户会话范围
- 应用程序全局范围
感谢
推荐答案
右键单击该项目,选择属性 - >设置。您可以编辑持久字段(即设置),指定名称,类型和范围(用户范围或应用程序范围内)。
Right-click the project, select properties->Settings. You can edit persistent fields (i.e. settings), specifying name, type and scope (user-wide or application-wide).
您可以从代码通过访问它们< ;默认命名空间方式> .Properties.Settings.Default
You can access them from the code by <Default Namespace>.Properties.Settings.Default.
的设置应用程序运行的持续性。
The settings are persistent between application runs.
您。应该使用这些设置表单范围过于
You should use these settings for the Form Scope too.
所有这些设置都有道理,用于存储应用程序运行之间的持久值。使用常规(静态)字段存储一个程序实例中的数据。
All these settings make sense for storing persistent values between application runs. Use regular (static) fields for storing data within one program instance.
这篇关于winform应用程序数据持久性(C#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!