在Windows窗体应用程序中编写跟踪信息 [英] Writing trace information in a windows form app
问题描述
我在一个静态方法,我想显示它正在生成的sql查询。
我没有访问messagebox.show,我的选择是什么? p>
最简单的方法是使用 System.Diagnostics.Debug.WriteLine
或 System.Diagnostics.Trace.WriteLine
。如果连接了调试器,则消息将显示在输出窗口中,否则运行 DebugView 查看消息(您需要使用过滤器来排除噪音)。
I know how to write trace statements that I can view in a webforms environment, but how do I do this in a windows forms app?
I am inside of a static method, and I want to display the sql query that it is generating.
I don't have access to messagebox.show, what are my options?
The simplest way is to use either System.Diagnostics.Debug.WriteLine
or System.Diagnostics.Trace.WriteLine
. If you have a debugger attached, the messages will show up in the output window, otherwise run DebugView to see the messages (you'll need to play with the filtering some to exclude the noise).
这篇关于在Windows窗体应用程序中编写跟踪信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!