Reading/writing an INI file

后端 未结 16 2382
南旧
南旧 2020-11-22 00:15

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

[Section]
=
...

Delphi has th

16条回答
  •  情深已故
    2020-11-22 01:06

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

    There are third party solutions available, though.

    • INI handlers can be obtained as NuGet packages, such as INI Parser.
    • You can write your own INI handler, which is the old-school, laborious way. It gives you more control over the implementation, which you can use for bad or good. See e.g. an INI file handling class using C#, P/Invoke and Win32.

提交回复
热议问题