黄沙百战穿金甲,不破楼兰终不还。这篇文章主要讲述C#Appconfig的读取与修改相关的知识,希望能为你提供帮助。
一、C#读取Appconfig内容
【C#Appconfig的读取与修改】private void button1_Click(object sender, EventArgs e)
{
string fileName=System.IO.Path.GetFileName(Application.ExecutablePath);
Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
string value = https://www.songbingjia.com/android/config.AppSettings.Settings["ip"].Value = https://www.songbingjia.com/android/txtIP.Text;
string value1 = config.AppSettings.Settings["username"].Value = https://www.songbingjia.com/android/txtUserName.Text;
string value2 = config.AppSettings.Settings["userpwd"].Value = https://www.songbingjia.com/android/txtPassword.Text;
config.Save();
MessageBox.Show("保存成功!");
}
二、修改Appconfig
private void ServerSetting_Load(object sender, EventArgs e)
{
string fileName = System.IO.Path.GetFileName(Application.ExecutablePath);
Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
string ip = config.AppSettings.Settings["ip"].Value;
string username = config.AppSettings.Settings["username"].Value ;
string userpwd = config.AppSettings.Settings["userpwd"].Value ;
txtIP.Text = ip;
txtUserName.Text = username;
txtPassword.Text = userpwd;
}
推荐阅读
- android图片文件的路径地址与Uri的相互转换
- android AIDL基础
- 嵌入式开发板-迅为4418开发板修改Android动态logo内容分享
- 由于缺少证书链,导致Android手机提示网站不安全
- Android 自定义录音播放动画View,让你的录音浪起来
- android将drawable下的图片转换成bitmap
- Android 你应该注意的开发规范
- Android模拟器访问本机服务器
- android计算器---思路以及计算器功能梳理(未完成)