惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
月光博客
月光博客
爱范儿
爱范儿
有赞技术团队
有赞技术团队
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
腾讯CDC
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
Microsoft Azure Blog
Microsoft Azure Blog
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
云风的 BLOG
云风的 BLOG
U
Unit 42
博客园 - 三生石上(FineUI控件)
A
About on SuperTechFans
N
Netflix TechBlog - Medium
Google DeepMind News
Google DeepMind News
雷峰网
雷峰网
L
LangChain Blog

博客园 - 点点小铺

招聘Delphi程序员,懂.Net----广州地区(08年4月1日前有效) 用C# 实现C/S模式下软件自动在线升级 判断一个字符串是否全是数字的多种方法及其性能比较(C#实现)--来源CSDN 使用ADOX创建Access数据库和表-- 来源于CSDN 运用C#制作屏幕捕捉程序(2) 运用C#制作屏幕捕捉程序(1) 通过WMI获得硬盘和CPU的物理序列号 探讨C#中字符串的加密 在 C# 中加载自己编写的动态链接库 用C#生成随机中文汉字验证码的基本原理 c#中结构与类的区别 C#中对注册表的操作 C#中调用Windows API的要点 C#的多线程机制初探(4) C#的多线程机制初探(3) C#的多线程机制初探(2) C#的多线程机制初探(1) C#中如何插入照片到Excel C#编程让Outlook乖乖交出帐户密码
C#中如何读写INI文件
点点小铺 · 2006-10-07 · via 博客园 - 点点小铺

C#中读取和写入ini文件的一段代码,其实本文只是指出一个方向,希望大家能够触类旁通。

  以下为代码全文:

  //INI文件
  [ DllImport ( "kernel32" ) ]
  private static extern bool WritePrivateProfileString ( string section ,string key , string val , string filePath ) ;
  //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
  {
  /// <summary>
  /// IniFile 的摘要说明。
  /// </summary>
  public class IniFile
  {
  private string FFileName;

  [DllImport("kernel32")]