在网上找了关于ini文件读写方法,还是没有找到ini文件中有一个Section多个Key的读写情况,在一篇C++文章中得到点提示操作如下:
1.创建ini文件读写类:
C#中读写INI文件using System.Runtime.InteropServices;
C#中读写INI文件
using System.Text;
C#中读写INI文件
C#中读写INI文件
namespace INIDemo

2.测试INI文件读写
C#中读写INI文件        //写入ini文件
C#中读写INI文件
        private void button1_Click(object sender, EventArgs e)
        }

结果:
[Section1]
Key1=Key1's Value
[Section2]
Key2=Key2's Value
[UseFileName]
file1=value1
file2=value2
file3=value3
file4=value4

相关文章: