2008年9月9日星期二

在C#中如何读写INI文件

//写ini文件

[ dllimport ( "kernel32" ) ] 【相关文章:走进C# (我的C#学习之旅)之二】

【扩展阅读:Northwind中一个特别之处】

private static extern bool writeprivateprofilestring ( string section ,string key , string val , string filepath ) ; 【扩展信息:用.net操作word】



//读ini文件(字符


[ dllimport ( "kernel32" ) ]


private static extern int getprivateprofilestring ( string section ,string key , string def , stringbuilder retval ,int size , string filepath ) ;

//读ini文件(数字


[ dllimport ( "kernel32" ) ]


private static extern int getprivateprofileint ( string section ,string key , int def , string filepath ) ;

//////////////////////////////////////////////////////////////


using system;


using system.io;


using system.runtime.interopservices;


using system.text;

namespace echoncomponentlibrary


{


///


/// inifile 的摘要说明。


///



public class inifile


{


private string ffilename;

没有评论: