同时引用System.Web和System.Windows.Forms [英] Referencing both System.Web and System.Windows.Forms
问题描述
在类库中同时引用 和System.Windows.Forms
到底有什么问题?
What exactly is wrong with referencing both System.Web
and System.Windows.Forms
in my class library?
例如,库可能包含一些需要引用Web或WinForms特定类的代码.
For example, library could contain some code which needs to reference Web or WinForms-specific classes.
推荐答案
如果执行此操作,则使用该库将产生开销,并且存在危险,即Web代码使用Forms lib,反之亦然.我将其分为3部分-一个公共的部分和一个Web和一个Forms部分,因此您只需要使用所需的公共部分.这样,您可以保证仅使用您应该使用的库.
Well, if you do this, you will have overhead if you use that library and the danger, that Web code uses the Forms lib and vice versa. I would split it in 3 Parts - a common one and one Web and one Forms part, so you only have to use the common and the part you need. By that, you guarantee that you only use the libs you are supposed to.
这篇关于同时引用System.Web和System.Windows.Forms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!