【发布时间】:2016-09-27 10:07:58
【问题描述】:
在我们所有项目中都包含的框架库中,我们有一个 Log 函数。
在框架中
public static class Log
{
GenericLog(string msg){ string caller = GETDLLNAME //implementation}
GenericError(string msg){ string caller = GETDLLNAME //implementation}
}
在其他代码中
using Framework;
public class foo
{
public string GenerateBar()
{
Log.GenericLog("FooBar");
}
}
有什么方法可以确定调用 Log.GenericLog 的 DLL 的名称吗?
【问题讨论】:
-
异常对象返回所有信息,从哪里产生错误,可以使用堆栈跟踪显示错误的完整描述
-
Assembly.GetCallingAssembly().CodeBase? -
我认为,您想要的要求可以通过Assembly Class 来解决。具体看一下这个方法。
标签: c# dll reflection