保存在应用程序运行期间获得的值的最佳方法 [英] Best way to save a value obtained during application run

查看:103
本文介绍了保存在应用程序运行期间获得的值的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

相对于C#而言,我要修改现有程序以控制C#中的电动机功能.我有一个按钮,用于请求电动机的当前电动机位置.我希望能够保存该值,然后根据需要再次调用它.过去,我是使用数据库/表适配器完成此操作的,但是在那种情况下,我只是从数据库访问数据而没有写回数据库.由于我只需要保存其中两个值(并使用上述按钮来更新它们),使用数据库似乎有点过头了,我想知道是否有一种标准的方法可以执行这种操作.谢谢.

Relatively new to C#, I''m modifying an existing program to control motor functions in C#. I have a button that requests the current motor position from the motor. I''d like to be able to save that value and then call it again as necessary. I''ve done this in the past using databases/table adapters, however, in those cases I was just accessing the data from the database and not writing back to the database. Since I only need to save two of these values (and have them update using the aforementioned button) it seems like overkill to use a database, and I was wondering if there is a standard method for doing this sort of thing. Thanks.

推荐答案

如果您不需要保留任何历史记录,则可以使用Settings对象,然后将它们存储在本地计算机上.
If you don''t need to keep any kind of history, I''d use a Settings object, and just store them on the local machine.


这篇关于保存在应用程序运行期间获得的值的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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