william007
asked on
How should I use debug.print in C#
In VB, we can use debug.print to print the text in a console, but how do we do the similar thing in C#? The objective is to test the written class.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, I choose Debug>Start Debugging, I can't see the word test appear in anyway...
maybe you have closed the immediate window
To display the Immediate window, choose Windows from the Debug menu and select Immediate.
To display the Immediate window, choose Windows from the Debug menu and select Immediate.
View... Other Windows... Command Window
Type:
immed
at the > prompt and press enter. The Immediate Window will magically appear.
Type:
immed
at the > prompt and press enter. The Immediate Window will magically appear.
private void button2_Click(object sender, EventArgs e)
{
StreamReader re = File.OpenText("c:\\MyFile.txt");
string input = null;
while ((input = re.ReadLine()) != null)
{
Debug.Print(input);
Debug.Write(input);
Debug.WriteLine(input);
}
re.Close();
}
This will work perfectly : Console.WriteLine( "test" );
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks:)
Debug.WriteLine