The best resources for developers

Registry vs. INI file for storing user configurable application settings. In Linux, registry vs. INI file for storing user configurable applications settings.

static void Parse()
    StreamReader tr = new StreamReader("config.ini");
    string line;
    Dictionary<string, string> config = new Dictionary<string, string>();

    while ((line = tr.ReadLine()) != null)
        // Allow for comments and empty lines.
        if (line == "" || line.StartsWith("#"))

        string[] kvPair = line.Split("=");

        // Format must be option = value.
        if (kvPair.Length != 2)

        // If the option already exists, it"s overwritten.
        config[kvPair[0].Trim()] = kvPair[1].Trim();

Tags: windows registry settings ini configuration-files

Source: By Kurt W. Leucht as answer to the question

This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 2.5

Related code-snippets: