如何保存一些全局设置,以便Windows应用程序运行时都可以读取? [英] How to save some global settings,so anytime the windows application runs,can read it?

查看:30
本文介绍了如何保存一些全局设置,以便Windows应用程序运行时都可以读取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我正在开发Windows应用程序,我需要设置一些全局变量,就像连接字符串,路径等.然后,在应用程序运行时,它应该具有此设置,直到对其进行更改为止.如何实现此目的?也许来自配置文件?有什么帮助吗?

在此先感谢;)

Hello everyone!

I am developing a windows application,and i need to set some global variables,just like connection strings,paths etc.Then anytime the application runs,it should have this settings until changes are made to them.How can i achieve this? Maybe from a configuration file? Any help please ?

Thanks in advance ;)

推荐答案

^ ]是有关如何使用设置的Microsoft文章.我认为它可能更接近您的需求.
Here[^] is a microsoft article about how to use settings. I think it may be closer to what you are looking for.


我找到了.ini文件解决方案,其中存储了设置.
感谢本文使用C#的INI文件处理类 [ ^ ]
I found the solution with .ini file,there i store the settings.
thanks to this article An INI file handling class using C#[^]


更好的方法是为此使用模块.
通过使用Module,您可以轻松访问所有公共函数,变量.然后,您只需创建该对象的对象并使用它即可.
Better Way is to use the Module for that .
with the use of Module you can access all the public functions ,variables easily.then after your have to just create object of that and used it.


这篇关于如何保存一些全局设置,以便Windows应用程序运行时都可以读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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