以前用VC做开发 里面有两个宏:
__FILE__ 和 __LINE__
C#中有类似的宏吗?
__FILE__ 和 __LINE__
C#中有类似的宏吗?
解决方案 »
- 如何初始化C#中的数组长度?
- 二进制数据问题
- c#的udp连接无法连接,接收不到数据!
- 根据给定值设置CheckBoxList哪些为已选择
- VS2005 c# 如何利用performanceCounter组件调用远程计算机的计数器 请高手指教 谢谢
- 高手何在??
- 在C#里如何调用Visio2002里的自动生成组织结构图的功能(难啊!!!)
- 各位DX,如何在DATAGRID控件中合并某一列?
- 通过代理上网,在.net里怎样用windows 2000 server自带的CDO组件发送邮件,smtp需要做怎样的设置?
- 对CSDN网站有些建议,大家讨论一下
- Convert.ToDouble(string)方法中,如果string的首字符为“-”(符号),就出错,请问怎么办?
- 困绕了无数高手多年的问题(如何判断WebBrowser下载完成)
#define DEBUG
#define VC_V7
public static void WriteErrorToEventLog(string applicationName, string msg)
{
StackFrame CallStack = new StackFrame(1, true);
int lineNumber = CallStack.GetFileLineNumber();
string msg2 = CallStack.GetFileName() + "\r\n"; // This get calling module's file name and adds to event log.
msg2 += "Line: " + lineNumber.ToString() + "\r\n"; // This get calling module's line number of call to this function.
msg2 += msg;
if (!EventLog.SourceExists(applicationName))
{
EventLog.CreateEventSource(applicationName, "Application");
}
EventLog.WriteEntry(applicationName, msg2, EventLogEntryType.Error, lineNumber);
}
找到了!