/// <summary> /// Initializes a new instance of the <see cref="SectionData"/> class. /// </summary> public SectionData(string sectionName, IEqualityComparer <string> searchComparer) { _searchComparer = searchComparer; if (string.IsNullOrEmpty(sectionName)) { throw new ArgumentException("section name can not be empty"); } _leadingComments = new List <string>(); _keyDataCollection = new KeyDataCollection(_searchComparer); SectionName = sectionName; }
/// <summary> /// Initializes a new instance of the <see cref="KeyDataCollection"/> class /// from a previous instance of <see cref="KeyDataCollection"/>. /// </summary> /// <remarks> /// Data from the original KeyDataCollection instance is deeply copied /// </remarks> /// <param name="ori"> /// The instance of the <see cref="KeyDataCollection"/> class /// used to create the new instance. /// </param> public KeyDataCollection(KeyDataCollection ori, IEqualityComparer <string> searchComparer) : this(searchComparer) { foreach (KeyData key in ori) { if (_keyData.ContainsKey(key.KeyName)) { _keyData[key.KeyName] = (KeyData)key.Clone(); } else { _keyData.Add(key.KeyName, (KeyData)key.Clone()); } } }
/// <summary> /// Initializes a new IniData instance using a previous /// <see cref="SectionDataCollection" />. /// </summary> /// <param name="sdc"> /// <see cref="SectionDataCollection" /> object containing the /// data with the sections of the file /// </param> public IniData(SectionDataCollection sdc) { _sections = (SectionDataCollection)sdc.Clone(); Global = new KeyDataCollection(); SectionKeySeparator = '.'; }
/// <summary> /// Initializes a new IniData instance using a previous /// <see cref="SectionDataCollection" />. /// </summary> /// <param name="sdc"> /// <see cref="SectionDataCollection" /> object containing the /// data with the sections of the file /// </param> public IniDataCaseInsensitive(SectionDataCollection sdc) : base(new SectionDataCollection(sdc, StringComparer.OrdinalIgnoreCase)) { Global = new KeyDataCollection(StringComparer.OrdinalIgnoreCase); }