winform 项目获取app.config 中appSettings节点数据
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="StartUpgrade.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<!-- checkin 文件夹和文件名 -->
<add key="checkin-filefolder" value="D:\NotePad++\"/>
<add key="checkin-filefolder-name" value="npp.6.1.3.Installer.exe"/> <!-- 出钞 文件夹和文件名 -->
<add key="outmoney-filefolder" value="D:\NotePad++\"/>
<add key="outmoney-filefolder-name" value="npp.6.1.3.Installer.exe"/> <!-- 入钞 文件夹和文件名 -->
<add key="inmoney-filefolder" value="D:\NotePad++\"/>
<add key="inmoney-filefolder-name" value="npp.6.1.3.Installer.exe"/> <!-- 字节数组 -->
<add key="bytearrary" value="10240"/>
<add key="upload-path" value="E:\Projects\Hotels\StartUpgrade\StartUpgrade\File\"/>
<add key="upload-url" value="http://192.168.1.200:8077/UpgradeFiles/"/>
</appSettings>
<system.serviceModel>
<bindings />
<client />
</system.serviceModel>
<applicationSettings>
<StartUpgrade.Properties.Settings>
<setting name="StartUpgrade_IStartUpgrade_UpgradeFile" serializeAs="String">
<value>http://192.168.1.155:8013/DataService/WebService/Interface/UpgradeFile.asmx</value>
</setting>
</StartUpgrade.Properties.Settings>
</applicationSettings> </configuration>
然后在winform中cs文件里这样调用:
/// <summary>
/// 获取配置文件里appsettings的数据
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
public string GetAppsettingStr(string str)
{
AppSettingsReader appReader = new AppSettingsReader();
return appReader.GetValue(str, typeof(string)).ToString();
}
winform 项目获取app.config 中appSettings节点数据的更多相关文章
- C# 对 App.config的appSettings节点数据进行加密
.NET平台下的Winform和Asp.net的配置文件默认都是明文保存的,本文使用的是.Net自身如何加密配置文件,不包含自定义的加密规则 但.Net是提供了直接对配置文件加密的功能的,使用.Net ...
- Web.config中appSettings节点值两种读取方法
<appSettings> <add key="ClientPort" value="5252"/> <add ...
- 修改和获取web.config或app.config文件appSettings配置节中的Add里的value属性 函数
1: /// <summary> 2: /// 修改web.config或app.config文件appSettings配置节中的Add里的value属性 3: /// </summ ...
- c#Winform程序调用app.config文件配置数据库连接字符串 SQL Server文章目录 浅谈SQL Server中统计对于查询的影响 有关索引的DMV SQL Server中的执行引擎入门 【译】表变量和临时表的比较 对于表列数据类型选择的一点思考 SQL Server复制入门(一)----复制简介 操作系统中的进程与线程
c#Winform程序调用app.config文件配置数据库连接字符串 你新建winform项目的时候,会有一个app.config的配置文件,写在里面的<connectionStrings n ...
- c# 根据配置文件路径,设置和获取config文件 appSettings 节点值
/// <summary> /// 获取编译后的主配置文件节点值 /// </summary> /// <param name="key">&l ...
- winform中读取App.config中数据连接字符串
1.首先要在工程引用中导入System.Configuration.dll文件的引用. 2.通过System.Configuration.ConfigurationManager.Connection ...
- 在Web.config或App.config中的添加自定义配置
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置,所以忍 ...
- 在Web.config或App.config中的添加自定义配置 <转>
.Net中的System.Configuration命名空间为我们在web.config或者app.config中自定义配置提供了完美的支持.最近看到一些项目中还在自定义xml文件做程序的配置 ...
- C# 读取app.config配置文件 节点键值,提示 "配置系统未能初始化" 错误的解决方案
新建C#项目,在app.config中添加了appSettings项,运行时出现"配置系统未能初始化"的错误,MSDN里写到,如果配置文件中包含 configSections 元素 ...
随机推荐
- Android_ProgressBar
xml文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns ...
- About xvfb
http://blog.csdn.net/span76/article/details/11473315 有时候我们不关注程序是否有界面(比如自动化测试),只要程序在运行就可以了 很感谢 xvfb 这 ...
- 报错---[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:3294**
原因: 新的SDK不允许在设置rootViewController之前做过于复杂的操作,导致在didFinishLaunchingWithOptions 结束后还没有设置rootViewControl ...
- MySQL创建/删除/清空表,添加/删除字段
创建表: create table tablename (column_name column_type); create table table_name( id int not null auto ...
- CentOS 简单命令
一.启动级别 Linux系统设置系统启动模式的方式可以修改(必须要以root身份登录才能修改).修改系统启动模式的配置文件是 /etc/inittab. 我们在切换到root用户后,然后 vi / ...
- 命令行界面下的用户和组管理之useradd和passwd命令的使用
命令行界面下的用户和组的管理之useradd和passwd命令的使用 useradd [-c comment] [-d dir] [-e expire] [-g group] [-G group1,g ...
- uiatuomator命令启动apk,与查找多个相同控件
背景:在做项目时,发现使用uiatuomator中遇到了一些问题,现在把解决方法和思路分享出来 案列1:使用命令去启动要运用的apk包 在做自动化时,需要通过命令去启动APK的包,我使用的是sdk中自 ...
- hdu 1093 A+B for Input-Output Practice (V)
A+B for Input-Output Practice (V) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/3276 ...
- 【C语言】4-指针
直接引用 1. 回想一下,之前我们是如何更改某个变量的值? 我们之前是通过变量名来直接引用变量,然后进行赋值: char a; a = 10; 2. 看上去是很简单,其实程序内部是怎么操作的呢? ...
- 转载:flash 跨域 crossdomain.xml
转载自http://hi.baidu.com/bozz_/item/e8b1c7c4ca31317489ad9e91 flash 跨域 crossdomain.xml 一.概述 位于www.cross ...