0

As mentioned in the title, I'm using Danny Beckett's ini file class defined here: Reading/writing an INI file

It works really great, and met all my initial requirements. However, I'd really like to be able to access a section and read all the key/value pairs in that section into a list/dictionary. Using this method, I could store my recent output history into the ini file.

In my case, it would list vendors/suppliers, and the last time my application updated their price lists in our database. Each entry would consist of the vendors name as the key, and a date string that indicates the last update for that vendor.

I know I can write a simple log file to do this, but it would be a nice add to the existing functionality.

I cannot think of how exactly to write the method that would read the whole section of keys and values, but it would be great if it returned a dictionary.

public Dictionary<string, string> ReadSection(string Section)
{
    var RetVal = new Dictionary<string, string>();
    // code to read the section and add it to dictionary
    return RetVal;
}
Griffin
  • 1
  • 1
  • The document you linked to includes this text: "The creators of the .NET framework want you to use XML-based config files, rather than INI files." I don't if that is true but the legacy INI file format is awful. – Kurtis Rader Aug 08 '23 at 05:08

0 Answers0