c# - Visual C# 和设置

标签 c# database settings

我正在使用 Visual C# 内置功能设置 来保存我程序的一些选项。 看起来它正在使用 xml 文件来保存我的值,我可以轻松地保存和加载设置,我的问题是如果我将源代码编译为应用程序,它在哪里保存这些值?它是否在某处制作了一个 xml 文件,如果是,那么在哪里? 我编译了一个程序并更改了一些设置,然后我将这个可执行文件传输到我妈妈的计算机上,但它在选项中有默认值。当我在她的计算机上对应用程序进行更改时,它保存了所有内容并记住了这些值。 程序在哪里创建此 xml 文件以获取设置?

最佳答案

问题已回答here

user.config 文件是在 <c:\Documents and Settings>\<username>\[Local Settings\]Application Data\<companyname>\<appdomainname>_<eid>_<hash>\<verison> 中创建的文件夹。其中:

* <c:\Documents and Settings> is the user data directory, either non-roaming (Local Settings above) or roaming.
* <username> is the user name.
* <companyname> is the CompanyNameAttribute value, if available. Otherwise, ignore this element.
* <appdomainname> is the AppDomain.CurrentDomain.FriendlyName. This usually defaults to the .exe name.
* <eid> is the URL, StrongName, or Path, based on the evidence available to hash.
* <hash> is a SHA1 hash of evidence gathered from the CurrentDomain, in the following order of preference:
     1. StrongName
     2. URL

        If neither of these is available, use the .exe path. 
* <version> is the AssemblyInfo's AssemblyVersionAttribute setting.

关于c# - Visual C# 和设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3924283/

相关文章:

intellij-idea - Java源代码被Intellij中的反编译文件取代

ios - 使用核心数据进行应用程序设置

C# TextWriter,允许读取文件:

c# - 从 await 恢复是如何实现的?

mysql - SQL - 根据列的内容拆分表

java - Android studio 中的首选项设置如何将 EditTextPreference 中的值连接到 TextView

c# - TPL 数据流和控制台应用程序不会终止应用程序

c# - 在 C# ASP.NET 中使用 LINQ 返回接下来的 5 行?

sql - 什么是列式数据库?

mysql - 如何在 Laravel 5.4 中将日期选择器保存到数据库中?