/// <summary> /// gets or sets a value of the given section. set: If the given section does not exist it will be created /// </summary> /// <param name="section"></param> /// <param name="key"></param> /// <returns>returns null when section or key not found</returns> public string this[string section, string key] { get { IniSection sec = IniSections.FirstOrDefault(f => f.Name == section); if (sec != null) { return(sec[key]); } return(null); } set { IniSection sec = IniSections.FirstOrDefault(f => f.Name == section); if (sec == null) { sec = new IniSection() { Name = section }; IniSections.Add(sec); } sec[key] = value; } }
/// <summary> /// gets a section /// </summary> /// <param name="section"></param> /// <returns>get: returns null if section not found</returns> public IniSection this[string section] { get { return(IniSections.FirstOrDefault(f => f.Name == section)); } set { for (int i = 0; i < IniSections.Count; i++) { if (IniSections[i].Name == section) { IniSections[i] = value; return; } } IniSections.Add(value); } }