`

using C# modify app.config in the run time

    博客分类:
  • C#
 
阅读更多

今天在印度的网站上发现一个很经典的代码,也对比了国内的网站的答案

发现了,国内的技术含量真是太低了,心情也不好了

为什么印度人能做到那么有技术性,我们为什么不能,还是学习的不够啊,所以果断的拿到国内来,和大家分享

 

希望在国内,我们IT业能有新的蓝天

 

1.app.config国内大多是把它当作xml处理

(哥们,你那叫修改,而不是在run time的环境中,鄙视)

2.简要说明下,印度人的代码

2.1  You can change App.config file runtime using C# in your windows application

 你可以改变app.config文件当你的windows form运行的时候

下面是代码

// Open App.Config of executable
 System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an Application Setting.
config.AppSettings.Settings.Remove("LastDateFeesChecked");
config.AppSettings.Settings.Add("LastDateFeesChecked", DateTime.Now.ToShortDateString());
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");

 不解释了,有注释

 

 

很好的代码,希望对大家有用

 

 

0
1
分享到:
评论

相关推荐

    modify_headers-0.7.1.1-fx.xpi

    profile.setPreference("modifyheaders.config.active", true); profile.setPreference("modifyheaders.config.alwaysOn", true); FirefoxBinary firefoxBinary = new FirefoxBinary(); //firefoxBinary....

    modifyName.zip

    "modifyName.zip" 提供了一个实用的小程序工具,专门用于批量修改文件名。这个工具对于那些需要对大量文件进行统一命名或重新命名的用户来说,无疑是一个高效且节省时间的解决方案。下面将详细介绍批量修改文件名这...

    u_index_modify.rar_In Time

    Output registers encode semantic information in their name. Need to lookup a table built at decl time.Input registers are referred to by their semantic name rather than by index. Use the mapping build...

    modify_config.zip

    "modify_config.zip" 是一个包含配置修改脚本及相关文件的压缩包,主要涉及"scripting"这一技术领域。从提供的文件列表来看,我们可以推测这个压缩包用于自动化处理配置文件或管理下载任务。以下是对这些文件内容...

    Python库 | plone.app.querystring-1.4.9-py2-none-any.whl

    **Python库 plone.app.querystring** `plone.app.querystring` 是一个针对Python开发的库,主要用于处理HTTP请求中的查询字符串。在Web开发中,查询字符串通常附在URL的末尾,用于传递参数到服务器。这个库提供了...

    Android.for.the.BeagleBone.Black

    With a variety of example apps that demonstrate key hardware communication concepts, this book will help you become an Android hardware interfacing pro in no time. Table of Contents Chapter 1. ...

    ASP.NET 4高级程序设计

    ASP.NET 4高级程序设计Many of the examples in this book use SQL Server. In most cases, it is assumed that you are using SQL Server Express. However, you can modify the connection string in the ...

    android-a programmer's guide

    Try This: Run the API Demos Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . 41 Android Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

    BURNINTEST--硬件检测工具

    - A printer to run the printer test, set-up as the default printer in Windows. - A CD ROM + 1 Music CD or Data CD to run the CD test. - A CD-RW to run the CD burn test. - A network connection and the ...

    BatchMD5Modify1.0.rar

    我们在做游戏资源或者其他资源的时候,经常要用到加密。否则游戏资源包被破解之后游戏资源就公开可见了,所以需要用到这款MD5加密软件,非常的好用

    Professional Refactoring in C# & ASP.NET

    In this first book to provide a hands-on approach to refactoring in C# and ASP.NET, you’ll discover to apply refactoring techniques to manage and modify your code. Plus, you’ll learn how to build a...

    Android代码-VirtualApp

    中国人猛戳这里 About VirtualApp is an open platform for Android that allows you to ...You are not allowed to modify the app module and put to the software market, if you do that, The consequences you kno

    Think.DSP.Digital.Signal.Processing.in.Python.1491938455_Early.Release

    By the end of the first chapter, you'll be able to decompose a sound into its harmonics, modify the harmonics, and generate new sounds. Subsequent chapters follow a logical progression that develops ...

    modify_headers.zip

    【标签】"modify 谷歌插件"进一步明确了这个压缩包的内容。"modify"可能指的是插件能够修改或查看HTTP头信息,而"谷歌插件"则明确了这是与谷歌浏览器兼容的扩展程序,用户只需将其安装到Chrome浏览器上,即可享受到...

    C# Game Programming Cookbook for Unity 3D - 2014

    1.1.3 Using the Singleton Pattern in Unity...........................5 1.1.4 Inheritance.................................................6 1.1.5 Where to Now?.............................................

    binset.v2.exe

    Modify the binary at 0 or 0x3000 binset.exe -f app.bin -s 0,0xff,0xff,0xff,0xff binset.exe -f app.bin -s 0x3000,0x55,0xaa,1,2,3,4 Modify and delete backups binset.exe -f app.bin -s 0,0xff,0xff,0...

    C# Design Patterns: A Tutorial

    Programmers use design patterns to organize objects in programs, making them easier to write and modify. C# Design Patterns: A Tutorial is a practical guide to writing C# programs using the most ...

    Android代码-termux-styling

    When developing (or packaging), note that this app needs to be signed with the same key as the main Termux app in order to have the permission to modify the required font or color files. License ...

Global site tag (gtag.js) - Google Analytics