在C#中存储应用程序设置 [英] Storing application settings in C#

查看:91
本文介绍了在C#中存储应用程序设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在C#中存储应用程序设置(例如用户名和密码,数据库位置...)的最佳实践是什么?

What is the best practice to store application settings (such as user name and password, database location ...) in C# ?

提示:我是新手.net和C#

Hint: I am new to .net and C#

推荐答案

应用程序范围(非用户特定)的应用程序配置设置属于app.config(对于

Application Configuration Settings that are application wide (non-user specific) belong in either app.config (for Desktop apps) or web.config (for Web apps).

对Web.config文件的各个部分进行加密非常简单,如此超级简单示例

Encrypting sections of a web.config file is quite simple as outlined in this Super Simple Example.

如果需要存储用户特定的设置(例如应用程序设置等)或与应用程序配置无关的应用程序范围的设置,则可以按如下所述使用设置文件:

If you need to store User specific settings (like application settings, etc.) or Application wide settings not related to application configuration you can use a Settings file as described here:

C#中的用户设置

这篇关于在C#中存储应用程序设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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