Created a Hashtable collection in Properties -> Settings I save it

private static void DisplayCompanyData(Type t) { if (Properties.Settings.Default.pluginInformation == null) // Имена плагинов которые мы подлючили Properties.Settings.Default.pluginInformation = new Hashtablу(); // Получить данные [CompanyInfo] var companyInfo = from ci in t.GetCustomAttributes(false) where (ci.GetType() == typeof(CompanyInfoAttribute)) select ci; foreach (CompanyInfoAttribute c in companyInfo) { // Коллекция ключ-значение Properties.Settings.Default.pluginInformation.Add(PLUGIN_NAME, c.PluginName); Properties.Settings.Default.pluginInformation.Add(DISPLAY_PLUGIN_NAME, c.DisplayPluginName); Properties.Settings.Default.pluginInformation.Add(PLUGIN_DESCRIPTION, c.PluginDescription); Properties.Settings.Default.pluginInformation.Add(AUTHOR, c.Author); Properties.Settings.Default.pluginInformation.Add(VERSION, c.Version); } // Сохраняем настройки программы Properties.Settings.Default.Save(); } 

In addition to this collection, there are more variables, so they are saved

    2 answers 2

    Try adding the SettingsSerializeAs(SettingsSerializeAs.Binary) attribute SettingsSerializeAs(SettingsSerializeAs.Binary) to the pluginInformation property in the Settings.Designer.cs file:

     [global::System.Configuration.SettingsSerializeAs(global::System.Configuration.SettingsSerializeAs.Binary)] public Hashtable pluginInformation { ... } 

    This attribute value allows you to serialize arbitrary objects into the settings file.

    • Thanks helped - Roma

    I hope you do not forget that only the settings from the User area are saved, and the settings from the Application are ReadOnly?

    I have never come across saving settings, but usually this happens because Settings cannot determine the fact of changes inside the Hashtable, since the link has remained the same!

    Try using twitch:

     Properties.Settings.Default.pluginInformation = Properties.Settings.Default.pluginInformation; 

    If it doesn't help, try creating a new hash table with each change:

     Properties.Settings.Default.pluginInformation = new Hashtable(Properties.Settings.Default.pluginInformation); 
    • Does not help, tell me where these settings are stored? - Roma