C# 基礎(十三)C# XML配置檔案、ini配置檔案的建立、讀寫:動態修改IP
阿新 • • 發佈:2018-12-26
一、簡介
傳統的配置檔案ini已有被xml檔案逐步代替的趨勢,這裡主要討論XML配置檔案。
二、ini網址
https://www.cnblogs.com/cncc/p/3415694.html(重點)
https://www.cnblogs.com/xmy-007/p/6400221.html
https://www.cnblogs.com/CUIT-DX037/p/6797271.html
http://www.cnblogs.com/NoticeWang/p/3267865.html
三、XML配置檔案
下面給定的一個例子,就能滿足你配置檔案的需求。注意這個配置檔案是獨立的,它是在我的工程中沒有新增上去的。它只是存在我設定的特定目錄中。
1、放在工作目錄下
2、xml的內容:
standalone="yes" 這段程式碼必須要有,才能保證檔案的獨立,即你不用在工程裡面新增IPconfig.xml檔案,你也可以訪問它。
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<library id="30">
<IP id="20">
<IPValue>192.168.6.2</IPValue>
</IP>
</library>
3、工程裡面不用新增IPconfig.xml檔案:在主程式新增即可。
4、參考部落格:
https://www.cnblogs.com/fengxuehuanlin/p/5631664.html
https://www.cnblogs.com/xuxiaoshuan/p/5752434.html
四、總結
關於XML的語法說明及其詳細的應用,在往後的部落格中給出。