本文介绍了内部可见不工作吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Newtonsofts的JSON反序列化器反序列化对象.它反序列化的对象需要在属性上具有私有设置器.为此,我尝试将内部属性公开给AssemblyInfo.cs中的Newtonsoft.Json程序集,但这失败了.这是代码行:

Im trying to deserialize an object using Newtonsofts''s JSON deserializer. The object it deserilizes to needs to have private setters on the properties. To achieve this, I tried exposing internal properties to the Newtonsoft.Json assembly in AssemblyInfo.cs but this failed. Here is the line of code:

[assembly: InternalsVisibleTo("Newtonsoft.Json, PublicKey=0024{ shortened }4002c7")]



缩短了公钥的可读性.



The public key is shortened for readability.

推荐答案


这篇关于内部可见不工作吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 01:24