/// <summary> /// Creates a subset configuration inside an existing configuration as a setting. /// </summary> /// <param name="configParent">The parent configuration</param> /// <param name="strIdentifier">The identifier of the setting.</param> /// <param name="iIndex">An index, if there is more than one setting available via the given /// <see cref="strIdentifier"/>.</param> public static njSubConfiguration CreateChild(this njAbstractConfiguration configParent, string strIdentifier, int iIndex = 0) { njSubConfiguration configSub = new njSubConfiguration(); configSub.LoadConfiguration(); configParent.Set(strIdentifier, configSub, iIndex); return(configSub); }
/// <summary> /// Returns a subset configuration. /// This method is equivalent to Get(strIdentifier, CreateChild(strIdentifier, iIndex), iIndex). /// </summary> /// <param name="configParent">The parent configuration</param> /// <param name="strIdentifier">The identifier of the setting.</param> /// <param name="iIndex">An index, if there is more than one setting available via the given /// <see cref="strIdentifier"/>.</param> public static njSubConfiguration GetSubConfig(this njAbstractConfiguration configParent, string strIdentifier, int iIndex = 0) { return(configParent.Get <njSubConfiguration>(strIdentifier, null, iIndex) ?? (configParent.CanWrite ? configParent.CreateChild(strIdentifier, iIndex) : null)); }