保存设置在.NET WinForms应用程序 [英] Save Settings in a .NET Winforms Application

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

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/26369/what-is-the-best-way-to-store-user-settings-for-a-net-application\">What是存储用户设置的.NET应用程序的最佳方式?

我已经找到了很多非常不同的例子,至于怎么一会从一个WinForms应用程序保存(每用户)应用程序设置。

I have found alot of VERY different examples as to how one would save application settings (per user) from a Winforms application.

我想,这样做正确的方法是用C#很简单,我希望有人能告诉我吗?

I imagine that the correct way to do this is very simple in c# and am hoping someone can enlighten me?

推荐答案

在某些时候,答案归结为口味的问题。我说你会至少这些选项结束:

At some point, the answer boils down to a matter of taste. I'd say you'll end up with at least these options:

  • store it in the registry, where you have the HKEY_CURRENT_USER key. Everything under it is user-specific. This is usually preferred when you want to store a bunch of small key-value pairs. The main advantage of this system is that your settings are easy to find and share throughout several different applications. To follow this path, you can start from here.
  • using .NET Application settings, provides the easiest way to access your settings at runtime. Again, it's better for using with key-value pairs of small-sized data. IMO, the main advantages of this method is its simplicity and the fact that it empowers you to use some .NET classes as values (not forcing you to convert everything into more basic types). To follow this path, you can start from here.
  • store it in User Data folders, which are usually hidden under the user's profile directory. This is preferred when you want to store a large amount of data or any number of files. The main advantage of this method is that you can manipulate your data as you would with any files (that may also be a disadvantage). To follow this path, you can start from here.

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

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