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_Notification
xml文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns ...
- RecyclerView, ListView 只显示一行内容 问题解决
Adapter 中的data有多行,但是RecyclerView只显示一行. 原因出在item的layout xml, 用了自动生成的RelativeLayout, 她的默认高度height属性是ma ...
- Lucene全文检索系列(一)
1. Lucene简介 Lucene是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎.Lucene以其方便使用.快速实施以及灵活性受到广泛的关注.它可以方便地嵌入到各种应用中实现针对应用的全文 ...
- cgi表单的处理
在HTML中,当客户填写了表单,并按下了发送(submit)按钮后,表单的内容被发送 到了服务器端,一般的,这时就需要有一个服务器端脚本来对表单的内容进行一些处理, 或者是把它们保存起来,或者是按内容 ...
- mvn常见命令
http://www.cnblogs.com/adolfmc/archive/2012/07/31/2616908.html 创建一个简单的Java工程:mvn archetype:create -D ...
- 微信平台(一)--获取access_token
事前思路准备 说在前面:如果要获取access_token,那么你需要appid,appsecret;另外需要post请求连接https://api.weixin.qq.com/cgi-bin/tok ...
- 【转】代码高处走 从VC6到VC9移植代码问题说明
首先可以直接用Visual Studio 2008的打开VC6的工作区文件和项目文件(dsw和dsp),并将其升级为VS2008的解决方案格式和项目格式(sln和vcproj),VC9的编译器相对于V ...
- OC4_NSString操作
// // main.m // OC4_NSString操作 // // Created by zhangxueming on 15/6/10. // Copyright (c) 2015年 zhan ...
- hibernate的dao操作不能提交到数据库问题的解决
刚学的时候总是各种错误,解决方法也无厘头的很 将UserDAO里面的的save方法修改try { getSession().save(transientInstance); log.debug(&qu ...
- [leetcode] 406. Queue Reconstruction by Height
https://leetcode.com/contest/6/problems/queue-reconstruction-by-height/ 分析:每个表示成(a,b)的形式,其实找第一个,就是b为 ...