什么是“AllInternalsVisible”?程序集参数:InternalsVisibleTo 属性?
我的 IntelliSense 在 [assemble:InternalsVisibleTo("AssemblyName")]
声明中提供了一个布尔命名参数“AllInternalsVisible=”。只需将光标定位在第二个双引号后面并按 Ctrl-空格键即可。那是什么 - 我在 MSDN 上找不到任何相关文档。我正在使用 VS2005 和 .Net 2.0。
作为一个相关主题,我正在对友元程序集进行一些研究,我认为一旦您授予友元程序集对内部结构的访问权限,友元程序集就可以访问所有内部结构,并且您无法真正了解它。这是真的,还是有一种方法(如上所述)可以授予友元程序集对某些内部类型/成员(但不是全部)的访问权限?
My IntelliSense is coming up with a boolean named parameter "AllInternalsVisible=" in an [assembly:InternalsVisibleTo("AssemblyName")]
declaration. Just position the cursor after the second double-quote and hit Ctrl-space. What is that - I cannot find any documentation on MSDN about that. I am using VS2005 and .Net 2.0.
As a related topic, I'm doing some research on friend assemblies, and I thought that once you grant a friend assembly access to internals, the friend assembly has access to ALL internals and you can't really get granular about it. Is that true, or is there a way (as suggested above) that you could grant a friend assembly access to some internal types/members but not all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
MSDN 说:
MSDN Says:
在 Silverlight,将其设置为 true 意味着具有“朋友”或“内部”可见性的所有内容都对其他程序集可见。如果未设置,则仅具有 FriendAccessAllowed 变得可见。
在桌面 .NET 中,不使用该属性,因为所有内部成员始终可见,正如您在问题中提到的那样。
In Silverlight, setting this to true means that everything with "friend" or "internal" visibility becomes visible to the other assembly. If it's not set, then only members with FriendAccessAllowed become visible.
In desktop .NET, the property is not used since all internal members always become visible, as you mentioned in your question.
微软说:
http://msdn.microsoft.com/ en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.allinternalsvisible.aspx
Microsoft says:
http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.allinternalsvisible.aspx