ConfigurationManager
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Number0" value=""/>
<add key="Number1" value=""/>
<add key="Number2" value=""/>
<add key="Number3" value=""/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
private void Button_Click_1(object sender, RoutedEventArgs e)
{
int i = int.Parse(ConfigurationManager.AppSettings["Number2"]);
this.txtMsg.Text = i.ToString();
}
Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
cfa.AppSettings.Settings["Number2"].Value = "";
cfa.Save();

ConfigurationManager的更多相关文章
- ASP.net 使用ConfigurationManager获取连接字符串
在解决方案资源管理器里右键单击解决方案选择“添加引用”,并且从 .net 中找到 System.Configuration 引用它 在项目的web.config文件中添加 <connection ...
- 如何让ConfigurationManager打开任意的配置文件
VisualStudio的配置文件很好很强大,用来保存数据库连接字符串或键值对都非常方便,只需要通过ConfigurationManager的ConnectionStrings或AppSettings ...
- System.Configuration引用后ConfigurationManager方法用不了
System.Configuration引用后ConfigurationManager方法却用不了,提示没有引用 需手动添加引用 项目-引用-右击-添加引用-找到System.Configuratio ...
- ASP.NET 系列:单元测试之ConfigurationManager
通过ConfigurationManager使用.NET配置文件时,可以通过添加配置文件进行单元测试,虽然可以通过测试但达不到解耦的目的.使用IConfigurationManager和Configu ...
- Visual Studio 当前上下文中不存在名称“ConfigurationManager”
Visual Studio调试出现错误:当前上下文中不存在名称“ConfigurationManager” 解决方法: 1.System.Configuration引用这个dll参考:http://k ...
- 使用ConfigurationManager类读写配置文件
使用ConfigurationManager类 读写配置文件app.config,以下为代码: view plaincopy to clipboard print? using System; usi ...
- 『随笔』C# 程序 修改 ConfigurationManager 后,不重启 刷新配置
基本共识: ConfigurationManager 自带缓存,且不支持 写入. 如果 通过 文本写入方式 修改 配置文件,程序 无法刷新加载 最新配置. PS. Web.config 除外:Web. ...
- 《ASP.NET1200例》当前上下文中不存在名称configurationmanager
当前上下文中不存在名称ConfigurationManager的解决方法 今晚做项目在DBHelper.cs类中的数据库连接要改到web.config里面调用,结果在编译的时候却发现提示错误: 当前上 ...
- 让ConfigurationManager打开任意的配置文件
VisualStudio的配置文件很好很强大,用来保存数据库连接字符串或键值对都非常方便,只需要通过ConfigurationManager的ConnectionStrings或AppSettings ...
- 用ConfigurationManager读取和修改配置文件
为了方便有时我们会把一些简单的配置的信息放入web.config文件里. 放到appSettings添加key value等信息. ConfigurationManager.AppSettings ...
随机推荐
- CentOS搭建NFS服务
系统结构 ----------------------------------------------------------------------------------------------- ...
- Win10系统下编译GEOS3.6.2
环境说明 1.Win10专业版.64位: 2.VS2012旗舰版: 3.cmake-3.9.0.64位: 资源准备 GEOS管网(http://trac.osgeo.org/geos)下载3.4.3版 ...
- [LeetCode 题解] Search in Rotated Sorted Array
前言 [LeetCode 题解]系列传送门: http://www.cnblogs.com/double-win/category/573499.html 题目描述 Suppose an array ...
- INDEX--创建索引和删除索引时的SCH_M锁
最近有一个困惑,生产服务器上有一表索引建得乱七八糟,经过整理后需要新建几个索引,再删除几个索引,建立索引时使用联机(ONLINE=ON)创建,查看下服务器负载(磁盘和CPU压力均比较低的情况)后就选择 ...
- c# is 和 as 的区别和使用
1:is 是判断类型,用于检查对象是否与给定类型兼容,不成功则不会抛出异常,如果兼容则返回true,如果不兼容则返回false.在进行类型转换之前用 f (P_obj is System.String ...
- NetCore入门篇:(十)Net Core项目使用Cookies
一.简介 1.Net Core可以直接使用Cookies,但是调用方式有些区别. 2.Net Core将Request和Response分开实现. 二.基本读写Cookies操作 1.写一个基本的读写 ...
- 使用C#创建windows服务续之使用Topshelf优化Windows服务
前言: 之前写了一篇“使用C#创建windows服务”,https://www.cnblogs.com/huangwei1992/p/9693167.html,然后有博友给我推荐了一个开源框架Tops ...
- C#之asp.net 及MVC 生成动态验证码:
C#之asp.net 及MVC 生成动态验证码: 1.生成验证码字符串 // 随机生成指定长度的验证码字符串private string RandomCode(int length) { string ...
- HTML、CSS
表格标签: 表格标签有:<table> <tr> <th> <td> 让内容居中的标签:<center> 按钮标签:<button&g ...
- 629. K Inverse Pairs Array
Given two integers n and k, find how many different arrays consist of numbers from 1 to n such that ...