public configurationGroup this[string key] { get { //return storage [key]; if (!storage.ContainsKey(key)) { //Console.Error.WriteLine("Configuring new group {0}...",key); storage[key] = new configurationGroup(); } return storage[key]; } /*set { storage [key] = value; }*/ }
public static void _Main(String[] args) { configurationGroup config = new configurationGroup (); // Dictionary<string,string > d = new Dictionary<string, string> (); //d ["key1"] = "value"; //d ["key2"] = "value"; //d ["key3"] = "value"; //config ["foo"] = d; config ["key1"] = "value"; config ["key2"] = "value2"; // config["key1"]["key2"] = "Value!"; // config ["group", "key"] = "value!"; //Console.WriteLine ("{0}", config ["foo"]); config.parse (";comment=true\n ## Another comment goes here \n" + "foo=bar\n" + "hello = world;\n" + "hello = universe\n"); Console.WriteLine ("{0}", config); }