[英]How to get the assembly name hosting a control at design-time
How do I get the name of the assembly hosting a control at design time. 如何在设计时获取托管控件的程序集的名称。
What I need to do is have access to this name so that I can do certain things depending on which assembly the control was used in. This control is internal and is not intended for public use before someone rags on me. 我需要做的就是访问此名称,以便我可以执行某些操作,具体取决于控件所使用的程序集。此控件是内部的,在某些人怒斥我之前,不打算公开使用。
EDIT: This works 编辑:这有效
if (this.ParentForm != null)
hostingAssembly = this.ParentForm.GetType().Assembly.GetName().FullName;
Something like this: 像这样:
yourControlInstance.GetType().Assembly.GetName();
This will give you AssemblyName and you can get its Name
, FullName
and some other parameters. 这将为您提供AssemblyName,并且您可以获取其Name
, FullName
和其他一些参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.