Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging C# WinForm apps

I am working in Microsoft Visual C# 2008 on a Windows Form application.

I would like to write some variables out to a window in the IDE to determine what values they contain. I thought perhaps I could write to the console using console.writeline however I did not see where I could open a console window.

Is there a command I should be using to write to the immediate window or some other place where the information can easily be seen in the IDE?

like image 870
Joseph U. Avatar asked Dec 28 '22 04:12

Joseph U.


1 Answers

Use Debug.WriteLine(). It's output goes to the Output window. Console.WriteLine() works the same way in a Winforms app but using Debug is better since that code automatically gets removed in the Release build.

And of course, you'll want to leverage the debugger first.

like image 139
Hans Passant Avatar answered Dec 31 '22 15:12

Hans Passant