使用独立存储时未处理 SecurityException

发布于 2024-10-03 05:11:30 字数 424 浏览 1 评论 0原文

使用此代码时,我收到上述错误:

        var userSettings = new UserSettings()
        {
            Username = TextBox_Username.ToString(),
            Password = TextBox_Password.ToString(),
            Operator = OperatorList.O2
        };

        var settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add("UserSettings", userSettings);
        settings.Save();

我不知道为什么?尽管。

When using this code I get the above error:

        var userSettings = new UserSettings()
        {
            Username = TextBox_Username.ToString(),
            Password = TextBox_Password.ToString(),
            Operator = OperatorList.O2
        };

        var settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add("UserSettings", userSettings);
        settings.Save();

I'm not sure why? though.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赢得她心 2024-10-10 05:11:30

修好了。任何存储的类都需要标记为公共标记类内部是不允许的。发生此问题的原因是 C# 并未默认使用新类的公共作用域。

Fixed it. Any stored class needs to be marked as public marking classes internal is not allowed. The issue happened because C# does not default to public scope with new classes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文