/// <summary> /// Creates a new instance of the <see cref="AppSettingsBase"/> class for the application's configuration file. /// </summary> /// <param name="configFile">Configuration file used for accessing settings.</param> /// <param name="requireSerializeSettingAttribute"> /// Assigns flag that determines if <see cref="SerializeSettingAttribute"/> is required /// to exist before a field or property is serialized to the configuration file. /// </param> /// <param name="initialize">Determines if <see cref="SettingsBase.Initialize"/> method should be called from constructor.</param> /// <remarks> /// Note that some .NET languages (e.g., Visual Basic) will not initialize member elements before call to constuctor, /// in this case <paramref name="initialize"/> should be set to <c>false</c>, then the <see cref="SettingsBase.Initialize"/> /// method should be called manually after all properties have been initialized. Alternately, consider using the /// <see cref="DefaultValueAttribute"/> on the fields or properties and this will be used to initialize the values. /// </remarks> protected AppSettingsBase(ConfigurationFile configFile, bool requireSerializeSettingAttribute, bool initialize) : base(requireSerializeSettingAttribute) { m_configFile = configFile; // Make sure settings exist and load current values if (initialize) Initialize(); }
/// <summary> /// Creates a new instance of the <see cref="CategorizedSettingsBase"/> class for the application's configuration file. /// </summary> /// <param name="configFile">Configuration file used for accessing settings.</param> /// <param name="categoryName">Name of default category to use to get and set settings from configuration file.</param> /// <param name="useCategoryAttributes">Determines if category attributes will be used for category names.</param> /// <param name="requireSerializeSettingAttribute"> /// Assigns flag that determines if <see cref="SerializeSettingAttribute"/> is required /// to exist before a field or property is serialized to the configuration file. /// </param> /// <param name="initialize">Determines if <see cref="SettingsBase.Initialize"/> method should be called from constructor.</param> /// <remarks> /// <para> /// If <paramref name="useCategoryAttributes"/> is false, all settings will be placed in section labeled by the /// <paramref name="categoryName"/> value; otherwise, if a <see cref="CategoryAttribute"/> exists on a field or /// property then the member value will serialized into the configuration file in a section labeled the same /// as the <see cref="CategoryAttribute.Category"/> value and if the attribute doesn't exist the member value /// will serialized into the section labeled by the <paramref name="categoryName"/> value. /// </para> /// <para> /// Note that some .NET languages (e.g., Visual Basic) will not initialize member elements before call to constuctor, /// in this case <paramref name="initialize"/> should be set to <c>false</c>, then the <see cref="SettingsBase.Initialize"/> /// method should be called manually after all properties have been initialized. Alternately, consider using the /// <see cref="DefaultValueAttribute"/> on the fields or properties and this will be used to initialize the values. /// </para> /// </remarks> protected CategorizedSettingsBase(ConfigurationFile configFile, string categoryName, bool useCategoryAttributes, bool requireSerializeSettingAttribute, bool initialize) : base(requireSerializeSettingAttribute) { m_configFile = configFile; m_categoryName = categoryName; m_useCategoryAttributes = useCategoryAttributes; // Make sure settings exist and load current values if (initialize) Initialize(); }