/// <summary> /// Adds a key to a concrete <see cref="PropertyCollection"/> instance, checking /// if duplicate keys are allowed in the configuration /// </summary> /// <param name="key"> /// Key name /// </param> /// <param name="value"> /// Key's value /// </param> /// <param name="keyDataCollection"> /// <see cref="Property"/> collection where the key should be inserted /// </param> /// <param name="sectionName"> /// Name of the section where the <see cref="PropertyCollection"/> is contained. /// Used only for logging purposes. /// </param> private void AddKeyToKeyValueCollection(string key, string value, PropertyCollection keyDataCollection, string sectionName) { // Check for duplicated keys if (keyDataCollection.Contains(key)) { // We already have a key with the same name defined in the current section HandleDuplicatedKeyInCollection(key, value, keyDataCollection, sectionName); } else { // Save the keys keyDataCollection.Add(key, value); } if (Configuration.ParseComments) { keyDataCollection.FindByKey(key).Comments = CurrentCommentListTemp; CurrentCommentListTemp.Clear(); } }