C 動態獲取 修改 更新配置檔案 實現思路

2021-07-13 13:49:04 字數 389 閱讀 1477

1、新增system.configuration.dll引用;程式中新增using system.configuration;

讀取資料:(tbhost為文字控制項)

2、修改、更新資料

private void btnok_click(object sender, eventargs e)

private void updateconfig(string key,string value)

說明:經常遇到的問題是修改資料後配置檔案未能立即生效,再次讀取時依然是修改前的資料。參考上述**時,如果還遇到這個問題,可嘗試把「xml方式」(即updateconfig()中注釋部分取消注釋)和congiguration方式一起使用。

C 動態獲取 修改 更新配置檔案 實現思路

1 新增system.configuration.dll引用 程式中新增using system.configuration 讀取資料 tbhost為文字控制項 csharp view plain copy print 2 修改 更新資料 csharp view plain copy print p...

C實現解析配置檔案

readconfigfile.cpp 定義控制台應用程式的入口點。include stdafx.h typedef struct configvalue configvalue typedef struct session session typedef struct configfile bool...

修改配置檔案啟示

修改 etc sysconfig i18n檔案 lang en us.utf 8 supported en us.utf 8 en us en sysfont latarcyrheb sun16 改為 lang zh cn.gb18030 language zh cn.gb18030 zh cn.g...