如果是一个exe程序,就可以用Application.ProductName获得,但是现在是一个类库,怎样获取调用者的这个ProductName呢?
解决方案 »
- 这个是手动写的还是什么工具生成的
- 求XML中的字符串转化为C#中字符串的函数
- 套接字和网络协议之间的关系
- WPF加了动画就慢~
- 很简单明了的问题 关于空间位置的问题?(C#)
- 大家帮忙看一下,用VS开发PPC程序,在新建组件时,怎么只能显示代码,而没有组件设计器,普通Windows程序则无此问题。
- 请各位帮帮忙!datagrid 样式中对border-color:#999999;怎么不作用啊?
- 如何禁止axwebbrowser中所有的js代码运行?
- asp.net求助
- 菜鸟提问,请大家帮忙解决
- 如何让一个linklabel运行时的内容不要是蓝色 并且 去掉不显示下划线?
- 怎么让combobox自动展开,------绝对放分!
if (asm != null)
{
object[] customAttributes = asm.GetCustomAttributes(typeof(AssemblyProductAttribute), false);
if ((customAttributes != null) && (customAttributes.Length > 0))
{
Console.WriteLine(((AssemblyProductAttribute)customAttributes[0]).Product);
}
}
在适当的地方通过如下的语句就可以得到调用DLL的误用程序的名称了:string appName = System.Windows.Forms.Application.ExecutablePath;
Console.WriteLine(System.IO.Path.GetFileName(appName));