vb.net 仅限外部的属性或方法
vb.net 中是否有一种简单的方法可以从内部名称空间中屏蔽公共属性或方法?作为一种重构工具,它将有助于隔离内部依赖关系,并可能对外部服务强制执行非递归策略。
Is there a simple way in vb.net to mask a public property or method from the internal namespace? It would be helpful as a refactoring tool to isolate internal dependencies and perhaps to enforce a non-recursion policy for external services.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不会。根据定义,任何可从外部世界使用的属性或方法也可在您的内部项目中使用。
不过,某些工具(例如 Resharper)可以简化此类策略检查。例如,Resharper 允许您查看正在使用属性或方法的调用站点的完整列表。您可以使用它来验证内部没有任何内容正在使用特定方法。
No. Any property or method that's usable from the external world is usable from your internal project as well, by definition.
Some tools, such as Resharper, though, can simplify checking policies like this. For example, Resharper lets you view an entire list of call sites where a property or method is being used. You could use this to verify that nothing internal is using a specific method.
正如 Reed 所说,在 VB.Net(或 C#)中无法做到这一点。
您可以采取的另一种方法是使用多个程序集。本质上,将两个逻辑组件放入不同的程序集中,并使用该边界作为强制执行手头策略的手段。您甚至可以稍后使用 ILMerge 等工具将程序集重新合并为一个程序集。
As Reed said, there is no way to do this in VB.Net (or C# for that matter).
Another approach you could take is to use multiple assemblies. Essentially put the two logical components into different assemblies and use that boundary as a means to enforce the policy at hand. You can even use a tool like ILMerge to combine the assemblies back into a single one at a later point.