使用隔离存储时未处理SecurityException [英] SecurityException was unhandled when using isolated storage

查看:155
本文介绍了使用隔离存储时未处理SecurityException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此代码时,出现上述错误:

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.

推荐答案

修复了该问题.任何存储的类都需要标记,因为内部不允许使用公共标记类.之所以发生此问题,是因为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.

这篇关于使用隔离存储时未处理SecurityException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆