行号 [英] Line No

查看:69
本文介绍了行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如何获得C-Sharp中的行号?对于登录目的,我想记录

错误发生的行号?


问候,

R.Baskar

Hi,
How to Get a Line Number in C-Sharp? For Loging purpose , i want to log
the Line no where the Error Happens?

Regards,
R.Baskar

推荐答案

您是否意识到执行代码看起来不像您在编辑器中编写的代码?一旦JIT工作了它的神奇,充满优化

并重写,内嵌等你将执行本机win32代码。


- -

ANDREAS H?KANSSON

软件工程学生

andreas(at)selfinflicted.org

" Baskar RajaSekharan < rb*@srasys.co.in>在留言新闻中写道:#J ************** @ TK2MSFTNGP09.phx.gbl ...



如何获取C-Sharp的行号?对于登录目的,我想记录

错误发生的行号?


问候,

R.Baskar
You do realize that the executing code looks nothing like the code you
write in an editor? Once the JIT has worked it''s magic, full of optimizations
and rewrites, in-lining etc you will be executing native win32 code.

--
ANDREAS H?KANSSON
STUDENT OF SOFTWARE ENGINEERING
andreas (at) selfinflicted.org
"Baskar RajaSekharan" <rb*@srasys.co.in> wrote in message news:#J**************@TK2MSFTNGP09.phx.gbl...
Hi,
How to Get a Line Number in C-Sharp? For Loging purpose , i want to log
the Line no where the Error Happens?

Regards,
R.Baskar


Baskar RajaSekharan写道:
Baskar RajaSekharan wrote:
如何在C-Sharp中获取行号?出于登录的目的,我想在错误发生的地方登录线路?
How to Get a Line Number in C-Sharp? For Loging purpose , i want to
log
the Line no where the Error Happens?




Release-Build没有解决方案。


对于Debug Build,您可以使用StackFrame-Class,如下所示:


< code>

系统.Diagnostics.StackFrame sf = new System.Diagnostics.StackFrame(true);

MessageBox.Show(sf.ToString());

//或sf.GetFileLineNumber( );

< / code>

发布 - 构建在运行时不支持行信息。


-

问候

Jochen


你需要一个内存泄漏查找器吗?
http://www.codeproject.com/tools/leakfinder.asp


请不要在新闻组中使用html格式


-

使用M2,Opera的革命性的e邮件客户端: http://www.opera.com/m2/
Please, don''t use html formatting in news groups

--
Using M2, Opera''s revolutionary e-mail client: http://www.opera.com/m2/


这篇关于行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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