winform应用程序数据持久性(C#) [英] WinForm App Data Persistance (C#)

查看:232
本文介绍了winform应用程序数据持久性(C#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我beleive在ASP.NET应用程序变量的短期持久性的最佳方法是:

I beleive the best ways of "variable short term" persistance in an ASP.NET application are:


  1. 会话变量(会话范围)

  2. 应用程序变量(适用范围)

  3. 页面视图(页范围)

  4. 应用程序设置(应用程序范围)

  5. ???

  1. Sessions Variable (Session Scope)
  2. Application Variable (Application Scope)
  3. Page View (Page Scope)
  4. Application Settings (Application Scope)
  5. ???

什么是变短期的最佳途径持久性在Windows窗体应用程序:

What are the best ways of "variable short term" persistance in a windows form application for:


  1. 表范围

  2. 用户会话范围

  3. 应用程序全局范围

感谢

推荐答案

右键单击该项目,选择属性 - >设置。您可以编辑持久字段(即设置),指定名称,类型和范围(用户范围或应用程序范围内)。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆