Most .NET applications do not need access to the old INI file format, so Microsoft decided not to include it in the .NET framework. Multiple other options are available, from .config files to the Registry. However, there are a handful of situations where an old INI file must be read.
Note that this is not a particularly well-designed class; I wrote it quickly. It’s posted here as an example of moderately difficult interop; specifically, how to read a multi-string value, where “multi-string” means a single buffer that is double-null-terminated and may contain embedded (single) nulls.
About Stephen Cleary
Stephen Cleary is a Christian, husband, father, and programmer living in Northern Michigan.