ConfigurationManager.AppSettings 属性 appSettings
https://msdn.microsoft.com/zh-cn/library/system.configuration.configurationmanager.appsettings(v=vs.110).aspx
ConfigurationManager.AppSettings 属性
var appSettings = ConfigurationManager.AppSettings;
appSettings.Count
appSettings.AllKeys NameValueCollection 中的所有键。
appSettings[key] NameValueCollection 中具有指定键的项
var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var settings = configFile.AppSettings.Settings;
if (settings[key] == null) { settings.Add(key, value); } else { settings[key].Value = value; }
configFile.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <appSettings> <add key="Setting1" value="May 5, 2014"/> <add key="Setting2" value="May 6, 2014"/> </appSettings> </configuration>
ConfigurationManager.AppSettings 属性 appSettings的更多相关文章
- c#修改config中的AppSettings属性
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); cfa.AppS ...
- ConfigurationManager.ConnectionStrings 属性
public static ConnectionStringSettingsCollection ConnectionStrings { get; } App.config <?xml vers ...
- ConfigurationManager.AppSettings方法
一 配置文件概述: 应用程序配置文件是标准的 XML 文件,XML 标记和属性是区分大小写的.它是可以按需要更改的,开发人员可以使用配置文件来更改设置,而不必重编译应用程序.配置文件的根节点是conf ...
- ConfigurationManager 读写AppSettings键值对
using System; using System.Configuration; namespace ConsoleApplication1 { class Program { static voi ...
- ConfigurationManager.AppSettings Property
在app.config文件中添加如下配置 <appSettings> <add key="Server" value="127.0.0.1"/ ...
- AppSettings和connectionStrings的却别(转)
AppSettings是ASP.NET1.1时期用的,在.NET Framework 2.0中,新增了ConnectionStrings. 1.<connectionStrings> &l ...
- <connectionStrings> <appSettings> 读取方法
C#中ConnectionStrings和AppSettings的区别 时间 2013-03-07 15:57:00 博客园精华区 原文 http://www.cnblogs.com/bindot ...
- [转载]AppSettings和ConnectionStrings的区别
AppSettings是ASP.NET1.1时期用的,在.NET Framework 2.0中,新增了ConnectionStrings. 1.<connectionStrings> &l ...
- AppSettings
1.winform中读写配置文件appSettings 一节中的配置. #region 读写配置文件 /// <summary> /// 修改配置文件中某项的值 /// </summ ...
随机推荐
- CF981C Useful Decomposition【树/思维】
[链接]:CF [题意]:给定一棵树,要求拆成若干条简单路径,并且这些路径都经过一个公共节点.给出任意一个解决方案,如不存在输出No. [分析]: 因为是一棵树, 所以如果要求任意两条路线至少有一个公 ...
- Codeforces Round #424 B. Keyboard Layouts(字符串,匹配,map)
#include <stdio.h> #include <string.h> ][]; ]; ]; int main(){ scanf(]); scanf(]); scanf( ...
- 2018 ACM-ICPC 南京网络赛
Problem A Problem B Problem C Problem D Problem E Problem F Problem G Problem H Problem I Problem J ...
- 贮油点问题(C++)
贮油点问题…..一道送命系列的递推… 描述 Description 一辆重型卡车欲穿过S公里的沙漠,卡车耗汽油为1升/公里,卡车总载油能力为W公升.显然卡车装一次油是过不了沙漠的.因此司机必须设法在沿 ...
- spoj - Longest Common Substring(后缀自动机模板题)
Longest Common Substring 题意 求两个串的最长公共子串. 分析 第一个串建后缀自动机,第二个串在自动机上跑,对于自动机上的结点(状态)而言,它所代表的最大长度为根结点到当前结点 ...
- 转:mysql group by 用法解析(详细)
group by 用法解析 group by语法可以根据给定数据列的每个成员对查询结果进行分组统计,最终得到一个分组汇总表. SELECT子句中的列名必须为分组列或列函数.列函数对于GROUP BY子 ...
- 【动态规划】Codeforces Round #392 (Div. 2) D. Ability To Convert
D. Ability To Convert time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 【博弈论】【SG函数】bzoj1777 [Usaco2010 Hol]rocks 石头木头
仅有距根节点为奇数距离的节点的石子被移走对答案有贡献,∵即使偶数的石子被移走,迟早会被再移到奇数,而奇数被移走后,不一定能够在移到偶数(到根了). 最多移L个:石子数模(L+1),比较显然,也可以自己 ...
- Problem E: 零起点学算法25——判断是否直角三角形
#include<stdio.h> int main() { int a,b,c; while(scanf("%d %d %d",&a,&b,& ...
- GetAdaptersInfo & GetAdaptersAddresses
I use GetAdaptersInfo to get MAC addresses of interfaces. GetAdaptersInfo exist on old and new ver ...