C# 等效于 Delphi 的 .INI 读取方法

标签 c# delphi

<分区>

Possible Duplicate:
Reading/writing INI file in C#

有哪些方法或 C# 库可以执行以下操作?谢谢

   //Delphi read item in a given  section of a binary file.
   uses iniFiles; 
   readString('SectionName','itemName','DefaultValueIfNotFound');

最佳答案

框架中没有用于直接读取 INI 文件的类,因为它们现在并不是一个好的选择。相反,通常建议您使用 Application Settings infrastructure或其他更灵活的技术,例如将信息保存在 XML 文件或数据库中。

不过很多人都写了自己的库,比如this one on CodeProject ,这将使您能够轻松地从 C# 中的 ini 文件的一部分中读取值。

关于C# 等效于 Delphi 的 .INI 读取方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8435807/

相关文章:

c# - 如何在没有副本的情况下将结构转换为字节数组?

c# - 循环中定义的 Linq 表达式的范围 - 问题 : closing over loop variable

arrays - 这是预期的 Delphi 动态数组行为吗

html - Delphi - 是否有适用于 VCL/FMX 应用程序的所见即所得 HTML 编辑器组件?

delphi - 传输到 ClientDataset 时的字符串截断

c# - 每次触发Form.Load事件

c# - 使用 GDI+ 绘制内容时如何使用 AutoScrollbar

c# - .NET MySQL 连接器冲突的 DbProviderFactories

multithreading - 套接字 : how execute two threads simultaneously without stop?

delphi - 为什么缺少可选参数会导致 "Incompatible types"错误