自定义设置缓慢加载(ApplicationSettingsBase)

时间:2013-07-30 19:57:52

标签: c# .net application-settings applicationsettingsbase

每次启动应用程序时,首次加载自定义设置大约需要2秒

有没有办法加速呢?

(或者这被广泛使用,as suggested here,尽管有速度惩罚。)

以下是代码:

public class MySettings : ApplicationSettingsBase
{
    [UserScopedSettingAttribute()]
    public int MyInt
    {
        get { return (int)(this["MyInt"]); }
        set { this["MyInt"] = value; }
    }
}

并且这样称呼:

MySettings s = new MySettings();
int i = s.MyInt;

0 个答案:

没有答案