[Mono-bugs] [Bug 439943] Save/Load user.config does not work

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 4 22:57:16 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=439943

User atsushi at ximian.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=439943#c6





--- Comment #6 from Atsushi Enomoto <atsushi at ximian.com>  2008-11-04 20:57:16 MST ---
I hate sample repro that depends on lots of extra stuff :/

using System;
using System.Collections.Specialized;
using System.Configuration;

public class Test
{
        public static void Main ()
        {
            if (Settings.Default.MySettings == null)
            {
                Console.WriteLine ("First run");
                StringCollection str = new StringCollection();
                str.Add("test1.txt");
                str.Add("test2.txt");
                Settings.Default.MySettings = str;
                Settings.Default.Save();
            } else {
                string txt = "";
                for (int i = 0; i < Settings.Default.MySettings.Count; i++)
                    txt += " " + Settings.Default.MySettings[i];
                Console.WriteLine ("Second run:" + txt);
            }
        }
}

    internal sealed partial class Settings : ApplicationSettingsBase {

        private static Settings defaultInstance = new Settings();

        public static Settings Default {
            get { return defaultInstance; }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        public StringCollection MySettings {
            get { return ((StringCollection)(this["MySettings"])); }
            set { this["MySettings"] = value; }
        }
    }


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list