读/写INI文件文件、INI

2023-09-02 01:16:34 作者:糖er

有没有类在.NET框架,可以读/写标准的.ini文件:

Is there any class in the .NET framework that can read/write standard .ini files:

[Section]
<keyname>=<value>
...

德尔福的 TIniFile 分量,我想知道是否有任何类似的C#?

Delphi has the TIniFile component and I want to know if there is anything similar for C#?

推荐答案

在.NET框架的创建者希望您使用基于XML的配置文件,而不是INI文件。因此,没有,没有内建机制阅读。

The creators of the .NET framework want you to use XML-based config files, rather than ini files. So no, there is no builtin mechanism for reading them.

有可用的第三方解决方案,但。看看 INI文件处理类。

There are third party solutions available though. Take a look at An INI file handling class using C#.