防止形式与行为公开的课程 [英] Prevent Forms & Classes being exposed

查看:54
本文介绍了防止形式与行为公开的课程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这听起来可能,或者实际上可能是一个相当新手,只是一个问题,但这是我刚刚发现并且似乎无法解决的问题.

我有一个已编译的WinForm应用程序,如果我创建一个新项目并添加对已编译程序集的引用(不是项目,而是实际的.exe文件),我仍然可以在设计时列出其所有形式和类,并访问所有他们的方法.

当然,我无法访问已声明为私有的方法,但仍然可以访问例如我的frmMain及其所有设置,并且基本上列出了程序集具有的所有类和形式.

有什么办法可以防止这种情况?为什么我不能将我的表单声明为私有表单,而只是将它们隐藏起来以免被这种方式暴露?

This may sound, or actually may be a pretty newbie and simply question, but this is something i just figured out and cant seem to deal with.

I have a compiled WinForm application, and if i create a new project and add a reference to the compiled assembly (not the project, but the actual .exe file) i still can list from design-time all its forms and classes and access all their methods.

Of course, i cannot access the methods i have declared as private, but still, i can access for example my frmMain and all it settings, and basically list all the classes and forms that the assembly has.

is there any way to prevent this? why i cannot declare my forms as private and just hide them from being exposed in such way?

推荐答案

在项目中,您可以访问未设置为这是设计使然.

为了解决这个问题,您可以将应用程序分区到项目中和/或对其进行预编译并使用DLL程序集.
Within a project you can access everything that is not set to private this is by design.

To overcome this you can partition your application into projects and/or precompile them and use the DLL assemblies.


这篇关于防止形式与行为公开的课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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