c#里有直接读取ini文件的函数吗?
解决方案 »
- 求教c#Windows Media Player怎么实现自动下一首
- 文件格式关联一个程序,不同格式显示不同图标。
- BatchExecNonQuery
- wav转byte[]然后再byte[]转wav
- C#写的应用程序不能以共享方式运行?一直奇怪也没有解决
- DataGrid统计的问题
- WINFORM 窗体内的 DataGrid 控件 选择的问题.
- C#中有没有内建对Quoted-Printable编码转换的支持?
- 一个项目工程太大,接盘的时候调试不知道断点打在哪
- 请看一下:我在看inside c#的chapter 8时,下面的例程总通不过
- IDE 问题:始终运行之前的源代码
- xml文件操作问题请教
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section,string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section,string key,string def,StringBuilder retVal,int size,string filePath);
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace Ini
{
public class IniFile
{
public string path;
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key,string val,string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key,string def, StringBuilder retVal,int size,string filePath); public IniFile(string INIPath)
{
path = INIPath;
}
public void IniWritevalue(string Section,string Key,string value)
{
WritePrivateProfileString(Section,Key,value,this.path);
}
public string IniReadvalue(string Section,string Key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(Section,Key,"",temp, 255, this.path);
return temp.ToString();
}
}
}