如何限制在另一个项目中使用财产 [英] How to restrict the usage of property in another project

查看:70
本文介绍了如何限制在另一个项目中使用财产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在 windows 应用程序和 web 应用程序中都使用了一个项目作为 dll(common.dll).我们在 common.dll 中定义了一个属性(webProp).webProp 应仅在 Web 应用程序中可见.该属性在 Windows 应用程序中不应该可见.

We have used one project as dll(common.dll) in both windows application and web application. We have defined one property(webProp) in common.dll. The webProp should visible only in web application only. That property should not visible in windows application.

有没有办法做到这一点?

Is there any way to do that?

提前致谢.

推荐答案

您可以将属性设置为内部,而您将不得不依赖 InternalVisibleToAttribute 使属性在 web 项目中可见,并且由于使用了内部属性,它在窗口项目中不可见.

You can make properties internal, and you would have to rely in InternalVisibleToAttribute to enable property to be visible in webproject and due to usage of internal attribute, its wouldn't be visible in window project.

这篇关于如何限制在另一个项目中使用财产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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