
public class MyWebClIEnt : System.Net.WebClIEnt{} 现在,当我初始化MyWebClIEnt时:
MyWebClIEnt wc = new MyWebClIEnt();
它会抛出TypeLoadException.我的 *** 作系统是windows 7(日语),因此错误消息不是英文版;我发现它与安全规则有关.可能是什么问题?
解决方法 WebClIEnt的构造函数标有SecuritySafeCritical属性.看起来这就是导致安全异常的原因.我尝试将相同的属性应用于MyWebClIEnt的构造函数,但这不起作用.从我读过的内容来看,Silverlight中不允许这样的事情.例如,请参阅 this other question.作为参考,确切的异常消息是:
System.TypeLoadException
inheritance security rules violated while
overrIDing member: ‘MyWebClIEnt..ctor()’. Security accessibility of
the overrIDing method must match the security accessibility of the
method being overrIDen.
我希望有更好的答案……
总结以上是内存溢出为你收集整理的Silverlight 4,继承WebClient全部内容,希望文章能够帮你解决Silverlight 4,继承WebClient所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)